Bored with orthodox Chess?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

OK, I see. It really helps when efficiency is no issue at all. :D

For Go I had something like this in mind:

Code: Select all

Kill(x, y, chaintype, delete, d)
{
    if(OFFBOARD(x,y)) return 0;
    piece = board[x][y];
    if(piece == EMPTY) return 1;
    n = 0;
    if(piece != chaintype && d > 0) return 0;
    board[x][y] = TEMP; // mark as visited
    do {
        n += Kill(x+1, y, chaintype, delete, d+1); 
        n += Kill(x-1, y, chaintype, delete, d+1); 
        n += Kill(x, y+1, chaintype, delete, d+1); 
        n += Kill(x, y-1, chaintype, delete, d+1); 
        board[x][y] = delete ? EMPTY : piece;
        delete = TRUE;
    } while(n == 0 && d++ == 1); // redo from d=1 node with delete = TRUE if no eyes
    return n;
}

MakeMove(...)
{
    ....
    if(variant == GO)
      Kill(toX, toY, OPPONENT, FALSE, 0);
    if(variant == CHECKERS)
      ClearRay(fromX, fromY, toX, toY);
    if(variant == REVERSI)
      ...
}
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

There is a new beta now that supports variant reversi, go and checkers (command line only!) In these variants the corresponding side effects of the moves should be applied automatically.

It also supports multiple moves per turn, through the discussed continuation mechanism: a hyphen behind the move suppresses turn changing, and will wait for the continuation of the move. Only works on moves in WB-protocol format (g1f3 etc.), not on SAN. WB is supposed to accumulate the move before sending it to the (opponent) engine. E.g. after receiving

move e1b1-
move a1c1


it should send

move e1b1-a1c1

to the opponent, (and perform a non-standard castling). This is completely untested! Unfortunately WB uses fixed-length arrays for storing the moves, so if they get too long (20 char) they will be clipped. To minimize the problem WB contracts moves that have matching to and from squares:

move b5d3-d3f5

would never be used, but contract to

move b5d3-f5

(also untested).

The SAN moves (displayed) will be crap.

Entering multi-moves is only possible by _typing_ the early legs; a move entered with the mouse will always be considered the final leg of the move, and terminate the entry. The display will be updated after each earlier leg, so you can grab an already moved piece to make the final leg. (What happens when your flag falls in this state is undefined...)

Move animation might cause trouble: it only animates the first leg, and sometimes the animation leaves a piece where it no longer is. This is just a display issue; using F2 (flipView) twice cures it.

Pieces can be dropped through the drop menu called by a right-click; you must have set /dropMenu true for this. This now also works for the first move. (Was not the case initially! :shock: )

Remember, this was just a quick hack job, and likely to be very buggy! The binary is at

http://hgm.nubati.net/WinBoard-4.5.beta.zip
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

Thanks! I am on it. I have all the move generators with correct perft ready but no search yet. So I will just set them to play random moves from their move list to see how it does. It may take me a while to make the changes and familiarize myself with console winboard :)
More later.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

Well, you can actually use it from the startup dialog, and type the required options in the "Additional options" field. The engine commands are also treated as appended to the command line. So you can install engines with /variant=checkers appended.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

Ok the checkers engine is sort of finished with the chess search I already had. It is doing 30+ search ..
I did as you said and first nebiyu played f6e5 which is rejected by winboard. This is using the GUI. The chess peices are displayed by default there but I thought it didn't matter.
What should I do ?

Debug of Nebiyu

Code: Select all

ht 2097152 X 64 = 128MB
<COMMAND LINE>
==============================
<000000000485>xboard
<000000000485>protover 2
feature name=1 myname="Nebiyu_12&#58;18&#58;30"
feature sigint=0 sigterm=0
feature variants="spartan,normal,checkers" setboard=1 draw=0 colors=0
feature smp=0 memory=0 egt="nebiyu"
feature option="log -check 0"
feature option="clear_hash -button"
feature option="resign -spin 800 100 30000"
feature option="smp_depth -spin 4 1 10"
feature option="cluster_depth -spin 1 8 16"
feature option="message_poll_nodes -spin 200 10 20000"
feature option="use_iid -check 1"
feature option="use_singular -check 0"
feature option="singular_margin -spin 30 0 1000"
feature option="futility_margin -spin 125 0 1000"
feature done=1
<000000000500>accepted done
<000000000500>accepted name
<000000000500>accepted myname
<000000000500>accepted sigint
<000000000500>accepted sigterm
<000000000500>accepted variants
<000000000500>accepted setboard
<000000000500>accepted draw
<000000000500>accepted colors
<000000000500>accepted smp
<000000000500>accepted memory
<000000000500>accepted egt
<000000000500>accepted option
<000000000500>accepted option
<000000000500>accepted option
<000000000500>accepted option
<000000000500>accepted option
<000000000500>accepted option
<000000000500>accepted option
<000000000500>accepted option
<000000000500>accepted option
<000000000500>accepted option
<000000000500>accepted done
<000000000516>new
<000000000532>random
<000000000532>variant checkers
<000000000532>level 40 1 0
<000000000532>post
<000000000532>hard
<000000000532>easy
<000000003625>force
<000000004157>computer
<000000004157>name Nebiyu_12&#58;18&#58;30
Hello Nebiyu_12&#58;18&#58;30!
<000000004157>time 6000
<000000004157>otim 6000
<000000004157>go
&#91;st = 1388ms, mt = 29250ms , hply = 1 , moves_left 40&#93;
&#91;0&#93; 2 208 0 18  d6e5 a3b4
&#91;0&#93; 2 208 0 40  d6e5 a3b4
&#91;0&#93; 3 182 0 122  d6e5 c3d4 e5c3 d2b4
&#91;0&#93; 3 188 0 246  f6g5 e3f4 g5e3 d2f4
&#91;0&#93; 3 188 0 294  f6g5 e3f4 g5e3 d2f4
&#91;0&#93; 4 188 0 314  f6g5 e3f4 g5e3 d2f4
&#91;0&#93; 4 205 0 506  d6e5 g3f4 e5g3 f2h4
&#91;0&#93; 4 205 0 523  d6e5 g3f4 e5g3 f2h4
&#91;0&#93; 5 205 0 659  d6e5 a3b4 b6c5 b4d6 e7c5
&#91;0&#93; 5 206 0 791  f6g5 a3b4 d6c5 b4d6 c7e5
&#91;0&#93; 5 206 0 837  f6g5 a3b4 d6c5 b4d6 c7e5
&#91;0&#93; 6 200 0 1171  f6g5 e3f4 g5e3 d2f4 d6e5 f4d6
&#91;0&#93; 6 206 0 1292  f6e5 a3b4 d6c5 b4d6 e7c5 g3h4
&#91;0&#93; 6 206 0 1314  f6e5 a3b4 d6c5 b4d6 e7c5 g3h4
&#91;0&#93; 7 196 0 1782  f6e5 a3b4 g7f6 g3f4 e5g3 f2h4 d6e5
&#91;0&#93; 7 200 0 1863  f6g5 e3f4 g5e3 d2f4 d6e5 f4d6 c7e5
&#91;0&#93; 7 200 0 2023  f6g5 e3f4 g5e3 d2f4 d6e5 f4d6 c7e5
&#91;0&#93; 8 172 1 2123  f6g5 e3f4 g5e3 d2f4 d6e5 f4d6 c7e5 a3b4
&#91;0&#93; 8 194 1 2366  f6e5 a3b4 g7f6 g3f4 e5g3 f2h4 d6c5 b4d6
&#91;0&#93; 8 194 1 2527  f6e5 a3b4 g7f6 g3f4 e5g3 f2h4 d6c5 b4d6
&#91;0&#93; 9 194 1 2830  f6e5 a3b4 g7f6 g3f4 e5g3 f2h4 d6c5 b4d6 c7e5
&#91;0&#93; 9 194 1 3792  f6e5 a3b4 g7f6 g3f4 e5g3 f2h4 d6c5 b4d6 c7e5
&#91;0&#93; 10 179 1 4699  f6e5 a3b4 g7f6 g3f4 e5g3 f2h4 f8g7 g1f2 f6g5 h4f6 g7e5
&#91;0&#93; 10 186 1 13745  b6a5 a3b4 a7b6 g3h4 f6e5 b4c5 d6b4 c3d4 e5c3 b2d4
&#91;0&#93; 10 186 1 13779  b6a5 a3b4 a7b6 g3h4 f6e5 b4c5 d6b4 c3d4 e5c3 b2d4
&#91;0&#93; 11 185 1 14817  b6a5 a3b4 a7b6 g3h4 f6e5 b4c5 d6b4 c3d4 e5c3 b2d4 g7f6
&#91;0&#93; 11 185 1 15008  b6a5 a3b4 a7b6 g3h4 f6e5 b4c5 d6b4 c3d4 e5c3 b2d4 g7f6
&#91;0&#93; 12 183 1 18886  b6a5 a3b4 a7b6 g3h4 f6e5 b4c5 d6b4 c3d4 e5c3 b2d4 h6g5 h4f6
&#91;0&#93; 12 183 1 19458  b6a5 a3b4 a7b6 g3h4 f6e5 b4c5 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a3b4 d6c5 b4d6 h8g7 f8h6 c7e5
&#91;0&#93; 23 159 75 2140831  d6e5 g3h4 b6c5 e3f4 e5g3 h2f4 c5b4 a3c5 f6g5 h4f6 g7e5 f2h4 e7d6 c5e7 d8f6 d2e3 f6g5 h4f6 f8e7 f6d8 h8g7 d8b6 a7c5
&#91;0&#93; 23 159 79 2149644  d6e5 g3h4 b6c5 e3f4 e5g3 h2f4 c5b4 a3c5 f6g5 h4f6 g7e5 f2h4 e7d6 c5e7 d8f6 d2e3 f6g5 h4f6 f8e7 f6d8 h8g7 d8b6 a7c5
&#91;0&#93; 24 146 114 3225997  d6e5 c3d4 e5c3 d2b4 f6e5 e3f4 b6c5 b4d6 e7c5 f4d6 c7e5 b2c3 a7b6 a1b2 f8e7 f2e3 c5d4 e3c5 e5d4 c3e5 d8c7 a3b4 g7f6 e5g7
&#91;0&#93; 24 153 115 3290934  f6e5 g3f4 e5g3 f2h4 e7f6 c3d4 f6e5 d4f6 g7e5 h4g5 h6f4 e3g5 d8e7 d2c3 e5f4 c3b4 b6c5 h2g3 f4h2 b4a5 e7f6 g5e7 d6e5 a3b4 f8d6
&#91;0&#93; 24 153 125 3562256  f6e5 g3f4 e5g3 f2h4 e7f6 c3d4 f6e5 d4f6 g7e5 h4g5 h6f4 e3g5 d8e7 d2c3 e5f4 c3b4 b6c5 h2g3 f4h2 b4a5 e7f6 g5e7 d6e5 a3b4 f8d6
nodes = 3562256 <29 qnodes> time = 1250ms nps = 2849804
lazy_eval = 0 splits = 0 badsplits = 0
<000000005407>move f6e5
<000000005407>result 0-1 &#123;Xboard&#58; Forfeit due to invalid move&#58; f6e5 &#40;f6e5&#41; res=23&#125;

&#91;FEN "1p1p1p1p/p1p1p1p1/1p1p1p1p/8/8/P1P1P1P1/1P1P1P1P/P1P1P1P1 b - - 0 1"&#93;

1.a1b2 f6e5 

<000000005407>force
<000000009969>quit
Bye Bye
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

I guess the problem is that the engine and WB are not starting from the same initial position. I did not program any initial positions for the new variants into WB, so it just starts from the default Chess position. So you should either play from an externally given position (e.g. using /lpf=start.fen, or pasting it before you start the game), or let the engine do it through sending

setup (P...Q.p...q.) 1p1p1p1p/p1p1p1p1/1p1p1p1p/8/8/P1P1P1P1/1P1P1P1P/P1P1P1P1

in response to the variant checkers command.

(But in this case white will start. Why do you have black starting in Checkers anyway?)
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

In checkers, black moves first. I will try to paste the fen and start from there.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

No luck with pasting FEN. See the image here
https://sites.google.com/site/dshawul/w ... ects=0&d=1
May be I should just send you the exe to toy with.
I haven't yet added the multiple move conversion, will do that once this gets solved.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: perft

Post by hgm »

Hmm, not over here... But we don't really play checkers, we play draughts, of course (the 10x10 game).

Anyway, in WB "white" is defined as the side that moves first. I use that even in Shogi, where Westerners insist that black moves first, although none of the Shogi pieces are actually black, as both sides play with white pieces, and the Japanese call it "Sente", which does not translate to a color at all. And the first (or zeroth) rank is by definition the one from which white plays. I guess even wth legality testing off WB will not allow you to move opponent's pieces, so it is important to stick to that.

If it offends your sense of how the board should look: the piece colors can be changed in the Board Options menu. You could even alter the clock naming by making a file shoginese.lng in the WB folder, containing the two lines

"White" === "Black"
"Black" === "White"

and then selecting "Shoginese" as language from the Help menu. :lol:
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: perft

Post by Daniel Shawul »

Yes the draughts I grew up with have different rules where men can't capture king's. And I now remeber white moves first in that one. There are also variations where the king can jump multiple steps, like the one you diagramed yesterday.
Here is the exe https://sites.google.com/site/dshawul/N ... ects=0&d=1