SebLague / Chess-Challenge

Create your own tiny chess bot!
https://www.youtube.com/watch?v=Ne40a5LkK6A
MIT License
1.78k stars 1.07k forks source link

Is there a way to know if a new game has started? #385

Closed Sparxel closed 11 months ago

Sparxel commented 11 months ago

I want to clear all move heuristics in case the current game ends and a new game starts. Is there any way to do this?

FrederoxDev commented 11 months ago

board.PlyCount would be 0 or 1 when it's your bots first move

Kreb08 commented 11 months ago

You get a new Instance of your bot for each game, non static values will be reset by default. You could use a constructor to reset static values like this public MyBot() { value = 0; } Also keep in mind when playing against the evil bot most of the games start from a random position where board.PlyCount > 1