Newbie chess program - Hansel

Discussion of chess software programming and technical issues.

Moderator: Ras

okidoki
Posts: 17
Joined: Thu Jun 30, 2022 12:46 pm
Full name: Kabir Kumar

Re: Newbie chess program - Hansel

Post by okidoki »

Most of the times Hansel beats TSCP (out of 37 games Hansel scored 30.5 and TSCP 6.5)
Here is a loss by Hansel which stumped me.
Hansel has Q-Search and the following evaluation features:
1. Material weights
2. Piece square table weights
3. Penalty for double pawns and Isolated pawns.
4. Bonus for passed pawns.
5. Attackers near king's ring (x-rays passing through rooks and queens)
6. Tapered evaluation (stockfish's ideas and almost the code),
Just to try out, following is being used. Please note this is an older version

Code: Select all

 while (bbWhiteQueenBlack > 0)
            {
                int sqFrom = Utilities.bitscan_forward(bbWhiteQueenBlack);

                ulong occupancyQueenBishop = ~Defs.BB_EMPTY;
                occupancyQueenBishop &= MagicBitBoards.BISHOP_ATTACK_INNER_MASK[sqFrom];
                occupancyQueenBishop *= MagicBitBoards.BishopMagic[sqFrom];
                occupancyQueenBishop >>= 64 - MagicBitBoards.BitForBishopAttack[sqFrom];
                ulong movesQueenAttackingKingRing = (MagicBitBoards.BishopAttacks[sqFrom, occupancyQueenBishop] & occupancyPiecesBlack) & kingRingWhite;

                queenAttackersBlack += Utilities.count_bits(movesQueenAttackingKingRing);

                ulong occupancyQueenRook = ~Defs.BB_EMPTY;
                occupancyQueenRook &= MagicBitBoards.ROOKS_ATTACK_INNER_MASK[sqFrom];
                occupancyQueenRook *= MagicBitBoards.RookMagic[sqFrom];
                occupancyQueenRook >>= 64 - MagicBitBoards.BitForRookAttack[sqFrom];
                ulong movesQueenRookAttackingKingRing = (MagicBitBoards.RookAttacks[sqFrom, occupancyQueenRook] & occupancyPiecesBlack) & kingRingWhite;

                queenAttackersBlack += Utilities.count_bits(movesQueenRookAttackingKingRing);

                bbWhiteQueenBlack &= bbWhiteQueenBlack - 1;

            }

            // Compute the difference.

            int whiteAttackCount = 2 * queenAttackers + 3 * rookAttackers + 4 * bishopAttackers;
            int blackAttackCount = 2 * queenAttackersBlack + 3 * rookAttackersBlack + 4 * bishopAttackersBlack;
            
[pgn][Event "Arena Tournament-1"]
[Site "Local"]
[Date "2022.07.07"]
[Round "17"]
[White "Hansel 64bit"]
[Black "Tscp181"]
[Result "0-1"]
[BlackElo "2200"]
[ECO "D01"]
[Opening "Richter-Veresov, 3.Nf3"]
[Time "12:44:14"]
[Variation "1...d5"]
[WhiteElo "2200"]
[TimeControl "300"]
[Termination "adjudication"]
[PlyCount "103"]
[WhiteType "program"]
[BlackType "program"]

1. Nc3 d5 {(d7d5 d2d4 g8f6 g1f3 b8c6 e2e3 e7e6) 0.00/7 10} 2. d4 Nf6 {(g8f6
e2e3 b8c6 g1f3 e7e6 f1b5 c8d7) 0.00/7 9} 3. Nf3 e6 {(e7e6 e2e3 f8b4 f1d3
b4c3 b2c3 e8g8 e1g1) +0.08/7 9} 4. Bg5 {(Bc1-g5 Bf8-b4 e2-e3 O-O Bf1-d3
Nb8-c6 O-O Rf8-e8 Ra1-c1 Bc8-d7) 0.00/10 10} Bb4 {(f8b4 d1d2 b8c6 g5f6 d8f6
e2e3 b4c3 d2c3) 0.00/8 9} 5. Qd3 {0.00/11 9} O-O {(e8g8 e2e3 b8c6 f1e2 b4c3
d3c3 c8d7 e1c1) +0.05/7 8} 6. O-O-O {(O-O-O Bb4-e7 Rd1-d2 Nb8-c6 Kc1-b1
Nc6-b4 Qd3-b5 Nf6-g4 Bg5xe7 Qd8xe7) 0.00/10 9} Bxc3 {(b4c3 d3c3 f6e4 c3e3
f7f6 g5f4 b8c6) +0.33/7 8} 7. Qxc3 {0.00/11 9} Ne4 {(f6e4 g5d8 e4c3 b2c3
f8d8 e2e3 b8c6 f1d3) +0.31/8 8} 8. Bxd8 {0.00/13 8} Nxc3 {(e4c3 b2c3 f8d8
e2e3 b8c6 f1d3 c8d7 e3e4 d5e4 d3e4) +0.38/8 7} 9. bxc3 {0.00/13 8} Rxd8
{(f8d8 e2e3 b8c6 f1d3 c8d7 d1e1 a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5 b3e3) +10.46/9 2} 48. Kxa4 {(Kb5xa4 c3-c2 f3-f4 c2-c1Q
Ka4-b5 Nd2-e4 f4-f5 Ne4-d6+ Kb5-b6 Qc1xe3 Kb6-c5) 0.00/10 2} c2 {(c3c2 f3f4
c2c1q a4b4 c1c4 b4a5 c4c3 a5b5 c3e3 d4d5 e3f4) +11.18/9 2} 49. Kb5 {(Ka4-b5
c2-c1Q f3-f4 Nd2-e4 Kb5-b4 Qc1-c3+ Kb4-b5 Ne4-d6+ Kb5-b6 Nd6-c4+ Kb6-c6
Nc4xe3+ Kc6-d6 Qc3xd4+) 0.00/10 2} c1=Q {(c2c1q f3f4 d2e4 b5b4 c1e3 d4d5
e3f4) +11.28/7 1} 50. f4 {(f3-f4 Nd2-e4 Kb5-b4 Qc1xe3 Kb4-c4 Qe3-c3+ Kc4-d5
Ne4-f6+ Kd5-e5 Qc3-e3+ Ke5-d6 Qe3xd4+ Kd6-e6 Nf6xh5) -36.73/10 2} Qc4+
{(c1c4 b5a5 c4d5 a5b4 d5h5 f4f5 h5f3 f5f6 f3e3 f6g7 f8g7) +11.53/6 1} 51.
Kb6 {(Kb5-b6 Qc4-e6+ Kb6-c5 Qe6xe3 f4-f5 Nd2-b3+ Kc5-b4 Nb3xd4 Kb4-c4
Nd4xf5 Kc4-d5 Kf8-e7) -36.84/9 2} Nf1 {(d2f1 d4d5 c4d5 e3e4 d5e4 b6c5 e4f4)
+12.70/6 1} 52. e4 {(e3-e4 Qc4xd4+ Kb6-b5 Qd4xe4 Kb5-c5 Qe4xf4 Kc5-c6
Qf4-f3+ Kc6-d6 Qf3xh5 Kd6-c6 Qh5-f3+ Kc6-d6 Nf1-e3) -39.03/11 1 Arena
Adjudication} 0-1[/pgn]

What stumped me was it was seeing the position as +3.. and from there on it went to lose. From the game, it was quiet evident to play 38. Bc4 and almost after few captures, White gets a passed d-pawn and is winning.
Can somebody explain which feature I need to correct / add to avoid this loss.
TheBlackPlague
Posts: 1
Joined: Thu Jun 09, 2022 12:49 am
Full name: Shaheryar Sohail

Re: Newbie chess program - Hansel

Post by TheBlackPlague »

Hello.

I'm glad you're interested in writing a chess engine in C#. Like you, very recently, I started writing my own chess engine in C#: StockNemo.

StockNemo has been majorly optimized and uses some of the best techniques available. For move generation, StockNemo has pre-generated tables wherever possible including Black Magic Fixed-Shift Tables for Sliding Pieces (Rook, Bishop, Queen). The idea is to move as much processing to compile or startup time to make runtime as fast as possible. This is a continued effort in regards to StockNemo, as I firmly believe it can be even faster. However, with move generation down to 8ns per piece on average, it is already reasonably fast.

For PERFT, to give StockNemo an insane advantage over other PERFT generators and engines, it has a multi-threaded PERFT algorithm. This allows StockNemo to hit higher depths than many other PERFT generators or engines. The algorithm has been optimized to use threads efficiently (ex. not wasting threads on lower depths which can be done faster rather than copying data for parallelization) as well as optimized for stack utilization.

Furthermore, if one wants to hit even higher depths, StockNemo features a Transposition Table designed specifically for PERFT. This allows for it to skip having to recompute PERFT at certain positions and depths.

Combining parallelization and transposition table, StockNemo has PERFT speeds as high as 168.3B nps. It goes to show C# code can be fast.

GitHub: https://github.com/TheBlackPlague/StockNemo
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Newbie chess program - Hansel

Post by hgm »

okidoki wrote: Thu Jul 07, 2022 4:21 pm What stumped me was it was seeing the position as +3.. and from there on it went to lose. From the game, it was quiet evident to play 38. Bc4 and almost after few captures, White gets a passed d-pawn and is winning.
Can somebody explain which feature I need to correct / add to avoid this loss.
Well, look at the PV after 39. Rxg6. This PV ends with a3-a2, and that is the position where the evaluation thinks that white has a +3.6 advantage. While in fact it cannot stop the promotion of the Pawn on a2. At the very least it should have evaluated that Pawn as nearly the same value as a minor (because 7th-rank Pawns are always passers, so that you need to dedicate one of your pieces to prevent their promotion). I am not sure if that would have been enough to dissuade the engine from trading the Rooks, though; capturing two Pawns might still seem attractive compared to the rise in value of the passer.

Of course you would have seen that if you had only searched 1 ply deeper, assuming you search promotions in QS. Some engines give an extension when the opponent has a Pawn on the 7th rank (or when a new Pawn reaches the 7th rank), so that you can be sure it cannot ignore the promotion.

But of course you might not search deep enough even with this extension to see the danger. The best solution would indeed be to have an evaluation term that recognizes the danger of an 'unstoppable passer'. Such passers are very common in Pawn endings, and relatively easy to recognize there. Humans use the 'rule of the square' for this, to see whether the King can reach the promotion square in time. That way the evaluation can already take into account that the Pawn is worth about a Queen. Here the situation is a bit more complex, since there still are Bishops. But after Kxc6 the a-pawn has indeed become 'unstoppable'.

Evaluating a highly advance passer is tricky. It usually either becomes a Queen (+8) or you will lose it (-1). That makes a very large difference. Evaluating it in between, like +4, will be very far off in all cases. The situation after Kxc6 is suspect, though, because white only has a Bishop. Which is on the light shade, while there is only a single light square on the path of the Pawn. The King is outside the area where it could prevent promotion. (Even if it were inside, on a crowded board, it might not be able to prevent the promotion because it is blocked and has to take a detour.) If the only other piece was a Knight, it can stop the Pawn on any shade, but, like the King, it can easily be too far away to get there in time.

In this case the Bishop can actually attack a2 in two moves, c3 + Bb1. Problem is that after c3 black plays Nd2, and then there is no square left for the Bishop to attack a2 where it is safe from the Knight. (b3 is also no good.) So there is a lot of relevant tactics here, and you cannot hope that a static evaluation would be able to find out how that ends. You really need the accuracy of search. So the logical solution is to award an extension when in doubt. You assume that a passer outside the reach of the enemy King will be able to promote when there is only a single other piece (by evaluating as +6 or so) that does not block or attack the path to promotion, and give an extension of nearly 1 ply to award extra depth in this game-deciding branch of the tree. This is pretty much what a human would do. As long as you have not determined with certainty whether that passer will promote or not, the fate of all other move sequences is completely irrelevant (unless there would be a checkmate there).
okidoki
Posts: 17
Joined: Thu Jun 30, 2022 12:46 pm
Full name: Kabir Kumar

Re: Newbie chess program - Hansel

Post by okidoki »

hgm wrote: Thu Jul 07, 2022 5:34 pm
okidoki wrote: Thu Jul 07, 2022 4:21 pm What stumped me was it was seeing the position as +3.. and from there on it went to lose. From the game, it was quiet evident to play 38. Bc4 and almost after few captures, White gets a passed d-pawn and is winning.
Can somebody explain which feature I need to correct / add to avoid this loss.
Well, look at the PV after 39. Rxg6. This PV ends with a3-a2, and that is the position where the evaluation thinks that white has a +3.6 advantage. While in fact it cannot stop the promotion of the Pawn on a2. At the very least it should have evaluated that Pawn as nearly the same value as a minor (because 7th-rank Pawns are always passers, so that you need to dedicate one of your pieces to prevent their promotion). I am not sure if that would have been enough to dissuade the engine from trading the Rooks, though; capturing two Pawns might still seem attractive compared to the rise in value of the passer.

Of course you would have seen that if you had only searched 1 ply deeper, assuming you search promotions in QS. Some engines give an extension when the opponent has a Pawn on the 7th rank (or when a new Pawn reaches the 7th rank), so that you can be sure it cannot ignore the promotion.

But of course you might not search deep enough even with this extension to see the danger. The best solution would indeed be to have an evaluation term that recognizes the danger of an 'unstoppable passer'. Such passers are very common in Pawn endings, and relatively easy to recognize there. Humans use the 'rule of the square' for this, to see whether the King can reach the promotion square in time. That way the evaluation can already take into account that the Pawn is worth about a Queen. Here the situation is a bit more complex, since there still are Bishops. But after Kxc6 the a-pawn has indeed become 'unstoppable'.

Evaluating a highly advance passer is tricky. It usually either becomes a Queen (+8) or you will lose it (-1). That makes a very large difference. Evaluating it in between, like +4, will be very far off in all cases. The situation after Kxc6 is suspect, though, because white only has a Bishop. Which is on the light shade, while there is only a single light square on the path of the Pawn. The King is outside the area where it could prevent promotion. (Even if it were inside, on a crowded board, it might not be able to prevent the promotion because it is blocked and has to take a detour.) If the only other piece was a Knight, it can stop the Pawn on any shade, but, like the King, it can easily be too far away to get there in time.

In this case the Bishop can actually attack a2 in two moves, c3 + Bb1. Problem is that after c3 black plays Nd2, and then there is no square left for the Bishop to attack a2 where it is safe from the Knight. (b3 is also no good.) So there is a lot of relevant tactics here, and you cannot hope that a static evaluation would be able to find out how that ends. You really need the accuracy of search. So the logical solution is to award an extension when in doubt. You assume that a passer outside the reach of the enemy King will be able to promote when there is only a single other piece (by evaluating as +6 or so) that does not block or attack the path to promotion, and give an extension of nearly 1 ply to award extra depth in this game-deciding branch of the tree. This is pretty much what a human would do. As long as you have not determined with certainty whether that passer will promote or not, the fate of all other move sequences is completely irrelevant (unless there would be a checkmate there).
Thanks for explaining me this. It seemed intuitive although by your reply I agree that search should do the work here smartly by having evaluation as its guidelines.
TheBlackPlague wrote: Thu Jul 07, 2022 4:29 pm Hello.

I'm glad you're interested in writing a chess engine in C#. Like you, very recently, I started writing my own chess engine in C#: StockNemo.

StockNemo has been majorly optimized and uses some of the best techniques available. For move generation, StockNemo has pre-generated tables wherever possible including Black Magic Fixed-Shift Tables for Sliding Pieces (Rook, Bishop, Queen). The idea is to move as much processing to compile or startup time to make runtime as fast as possible. This is a continued effort in regards to StockNemo, as I firmly believe it can be even faster. However, with move generation down to 8ns per piece on average, it is already reasonably fast.

For PERFT, to give StockNemo an insane advantage over other PERFT generators and engines, it has a multi-threaded PERFT algorithm. This allows StockNemo to hit higher depths than many other PERFT generators or engines. The algorithm has been optimized to use threads efficiently (ex. not wasting threads on lower depths which can be done faster rather than copying data for parallelization) as well as optimized for stack utilization.

Furthermore, if one wants to hit even higher depths, StockNemo features a Transposition Table designed specifically for PERFT. This allows for it to skip having to recompute PERFT at certain positions and depths.

Combining parallelization and transposition table, StockNemo has PERFT speeds as high as 168.3B nps. It goes to show C# code can be fast.

GitHub: https://github.com/TheBlackPlague/StockNemo
I saw your code, and it seems it is written very nicely. However due to my lack of understanding of C#, it is difficult for me to assimilate.
Like your code, I changed mine to utilize structs and make the move list to be instance based and expected speed gain, however this is not the case.
I would like to understand why is mine slower (single threaded without TT) than yours. If it is not too much of hassle for you, can you go through my code and provide a feedback if it is not too much to ask.

Here is the github link for my code : https://github.com/frankcastle64/Hansel ... StaticImpl

Thank you.
okidoki
Posts: 17
Joined: Thu Jun 30, 2022 12:46 pm
Full name: Kabir Kumar

Re: Newbie chess program - Hansel

Post by okidoki »

I have rewritten the program since I ran into many difficulties in my first attempt.

Now my program has the following features.
1. Negamax with alpha-beta pruning. (no internal iterative, no null move, no LMR, no TT).
2. QSearch expanding captures only.
3. Move ordering via MVV/LVA.
4. Evaluation using material values and PSQT. (This is taken from Rofchade version of TSCP)
5. Evaluation uses tapered eval.

Few more details, it on an average gets to 1.5 Mnps+ nodes for processing and reaches depth of 6 in less than 1 sec and 7 in about 3secs.
My aim here is to have a fast search and light eval, allowing engine to make its own decision guided by tapered eval and mobility.

Here are couple of the losses it had with TSCP. :cry: Please feel free to analyse them and if possible share some insights where it can be improved.

Please let me know if this is expected or if in your experience the moves played are buggy.
Thank you :)

[pgn]
[Event "Computer chess game"]
[Site "DESKTOP-I4JNID7"]
[Date "2022.12.13"]
[Round "?"]
[White "Tscp181"]
[Black "Hansel"]
[Result "1-0"]
[BlackElo "2200"]
[ECO "B01"]
[Opening "Scandinavian"]
[Time "13:10:19"]
[Variation "2...Qxd5 3.Nc3"]
[WhiteElo "2200"]
[TimeControl "600"]
[Termination "time forfeit"]
[PlyCount "141"]
[WhiteType "program"]
[BlackType "program"]

1. e4 {(e2e4 e7e5 g1f3 g8f6 b1c3 b8c6 d2d4 d7d6) +0.18/8 20} d5 {(d7-d5
f2-f3 d5xe4 f3xe4 Qd8-d4 Nb1-c3 Ke8-d8) 0.00/7 7} 2. exd5 {(e4d5 g8f6 f1b5
c8d7 b5c4 e7e5 d5e6 d7e6 c4e6 f7e6) +0.55/7 19} Qxd5 {(Qd8xd5 Nb1-c3
Qd5-e6+ Bf1-e2 Nb8-c6 Ke1-f1 Ke8-d8) -0.13/7 6} 3. Nc3 {(b1c3 d5a5 d2d4
e7e5 g1f3 b8c6 f1c4) +0.60/7 18} Qe6+ {(Qd5-e6+ Bf1-e2 Qe6-g6 Ke1-f1 Bc8-f5
Be2-h5 Bf5xc2) -0.41/7 23} 4. Nge2 {(g1e2 b8d7 d2d4 e6b6 a1b1 e7e5 c1e3)
+0.60/6 18} Nf6 {(Ng8-f6 d2-d4 Ke8-d8 Qd1-d2 Qe6-f5 Ke1-d1 Qf5xf2) -0.12/7
13} 5. d4 {(d2d4 b8d7 a2a4 e6d6 f2f4 e7e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
[Date "2022.12.13"]
[Round "?"]
[White "Hansel"]
[Black "Tscp181"]
[Result "0-1"]
[BlackElo "2200"]
[ECO "A06"]
[Opening "Reti Opening"]
[Time "13:43:37"]
[Variation "1...d5 2.e3"]
[WhiteElo "2200"]
[TimeControl "600"]
[Termination "normal"]
[PlyCount "66"]
[WhiteType "program"]
[BlackType "program"]

1. Nf3 {(Ng1-f3 d7-d5 e2-e3 Bc8-g4 Bf1-d3 Bg4xf3 Qd1xf3) +0.55/7 4} d5
{(d7d5 d2d4 g8f6 b1c3 b8c6 e2e3 e7e6 f1d3) -0.25/8 20} 2. e3 {(e2-e3 Nb8-c6
Bf1-b5 Qd8-d7 Bb5xc6 Qd7xc6 O-O) +0.66/7 12} e6 {(b8c6 d2d4 e7e6 f1b5 c8d7
e1g1 g8f6) -0.05/7 19} 3. Bb5+ {(Bf1-b5+ Bc8-d7 Bb5xd7+ Qd8xd7 O-O Ke8-d8)
+0.33/6 5} Bd7 {(c8d7 b5e2 g8f6 e1g1 f8d6 d2d4 e8g8 b1c3) -0.10/7 18} 4.
Qe2 {(Qd1-e2 Nb8-c6 d2-d4 a7-a6 Bb5xc6 Bd7xc6 O-O) +0.68/7 4} Nf6 {(c7c6
b5a4 g8f6 e1g1 f8d6 d2d4 e8g8) +0.38/7 18} 5. Bxd7+ {(Bb5xd7+ Qd8xd7 Nf3-e5
Qd7-a4 Ke1-d1 Nf6-e4 Nb1-c3) +0.63/7 8} Nbxd7 {(b8d7 d2d4 f8d6 e1g1 e8g8
b1c3 e6e5 c1d2) +0.18/7 17} 6. O-O {(O-O Bf8-d6 Qe2-b5 Qd8-c8 Nb1-c3 O-O)
-0.09/6 5} e5 {(e6e5 d2d4 e5e4 f3d2 f8d6 c2c4 d8e7) +0.40/7 16} 7. Nc3
{(Nb1-c3 Qd8-e7 Qe2-b5 Qe7-b4 a2-a3 Qb4xb5 Nc3xb5) +0.64/7 10} e4 {(e5e4
f3e1 f8b4 e2b5 b4c3 d2c3 a8b8) +0.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