Skip to content

Chess prototype#147

Closed
namin wants to merge 3 commits intosuragnair:masterfrom
namin:_chess
Closed

Chess prototype#147
namin wants to merge 3 commits intosuragnair:masterfrom
namin:_chess

Conversation

@namin
Copy link

@namin namin commented Dec 31, 2019

Hi,

Thanks for this great work. I love how everything is pluggable.

I don't claim this is ready as is for merging, but just wanted to let you know that I am interested in contributing a small chess implementation.

API changes:

  • I added an optional toArray in the Game interface so that the board representation can be more general for self play and just converted to an array for the neural network.
  • I noticed that Arena calls getGameEnded passing player 1 instead of the current player. This seems OK, but just wanted to amend the documentation.

Chess:

  • I called the directory _chess instead of chess because I am using python-chess via import chess...
  • I am not sure at all about the neural network. Just changed from conv2d to conv3d in the most obvious way.
  • I am still testing whether I can get any interesting results.

(The changes to main.py are FYI, not to be merged.)

Thanks again for this work. It's been so much fun and enlightening to play with it.

@namin
Copy link
Author

namin commented Jan 4, 2020

Note that this doesn't work at all, because it never seems to get out of draw in self play phase.

@namin
Copy link
Author

namin commented Jan 5, 2020

I will close this pull request as I refine the code further first, but curious to hear if you have any thoughts already.

Thanks and sorry for the noise.

@namin namin closed this Jan 5, 2020
@suragnair
Copy link
Owner

suragnair commented Jan 5, 2020

Hi Nada

Thanks so much for taking the time to take a deep dive into the code and writing up a chess implementation. It would definitely be a super useful addition to the repository.

The API change seems fine, the only caveat is that files for other games will need to be modified to add that method (should be just 2-3 lines).

Would be worth testing it to see if it gets out of the draws in self-play. If it doesn't, it might be due to a bug either in the game logic or in the neural network architecture or training.

Good luck and I'm looking forward to the chess implementation!


print('NEW/PREV WINS : %d / %d ; DRAWS : %d' % (nwins, pwins, draws))
if pwins+nwins == 0 or float(nwins)/(pwins+nwins) < self.args.updateThreshold:
if (not (pwins+nwins == 0)) and (float(nwins)/(pwins+nwins) < self.args.updateThreshold):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? this change?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has not been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants