https://github.com/StefanSalewski/nim-chess
It may work on Linux boxes with GTK3.
Plain board with unicode pieces looking like
Great work.
I tried a game, and found a bug. My last move was Rg3 check, and black replied by Qb1 check. If you need any data please tell me. At least I have a screenshot of the last position.
Ah yes, interesting! I guess it thinks when you can capture a king and it can later, it is equal! Funny!
Tried to fix it already. Basically added something like
if el.df.abs == KingID: result.score = AB_inf; return
at the beginning of move list processing (at 3 locations). So capture of king can not be compensated by capture of opposite king later. Stll untested -- to really test I should set up special positions, but that is not much fun. Later I should add some end of game message, like "Human is ckeckmate in ..." or "Game terminated". A bit more difficult is indicating Ckeck, not really hard, should work similar like the allread used en passant bits.
Ok, thx. Will tell you if I'm in a situation where I'll give a check.
Another bug. White pawn at e5, black plays d7-d5 and then exd6 (beating en passant) isn't possible.
Thanks for your reports. I will look at that in the next days, should be not that difficult to fix.
[EDIT]
Another bug. White pawn at e5, black plays d7-d5 and then exd6 (beating en passant) isn't possible.
OK, I think I found that. In proc do_move():
pjm = (p0 - p1) div 2 # that is nomsense, should be pjm = (p0 + p1) div 2
So my feeling is that the computer saw the ep, but human could not really do it. Will fix that at github tomorrow.
and suddenly out of nothing there are two black pawns at h7 and g7.
After some thinking I have an idea: I use bitsets to handle ep and to mark base row attack to indicate when castling is not allowed. I used the same array for that, called mobset, I thought that the bits do not conflict. Maybe they do, and I have to use separate variables. Should not decrease performance, but uses some more memory, which may be a problem when Nim is available for C64 or Sinclair ZX81 :-)
[EDIT2]
Thanks for all your bug reports. I have identified all of them, and already tried to apply easy fixes. I will add check message and game over messages tonight, before I push new version to github.
Should be all fixed now, just pushed fixes to github.
Check indication, filtering of moves when in check, stalemate prevention and better mating strategy added. But not much tested yet.
I tried some games.
The only error I did spot is the en passant beating.
board[p1 - sign(board[p0]) * 8] = VoidID
#board[p1 - sign(board[p0] * 8)] = VoidID
Stupid typo, fixed at github. Thanks for reporting.
When you do not like GTK3 that much, you may now also try NimX.
Yuriy Glukhov has made a pull request for an adapted board, which I just merged.
You have to install NimX and need installed sdl2 library.
nimble install nimx
I was able to compile that one with
nim c --noMain --threads:on board_nimx.nim
But I can not really try it on my linux box, it tries to open
Tried font '/usr/share/fonts/truetype/ubuntu-font-family/Arial Unicode.ttf' with no luck Tried font '/usr/share/fonts/TTF/Arial Unicode.ttf' with no luck Tried font '/usr/share/fonts/truetype/dejavu/Arial Unicode.ttf' with no luck
But I have only
ls /usr/share/fonts/ cantarell default dejavu encodings urw-fonts util
So not only ariel is missing, but directories are wrong too. I will not try to fix that yet. Maybe it works for Windows or Ubuntu.