jromang / picochess

GNU General Public License v3.0
74 stars 54 forks source link

Sliding pieces when making a move #1

Closed sshivaji closed 10 years ago

sshivaji commented 10 years ago

If I play 1.e4 by lifting the pawn from e2 and then placing it on e4, the code works fine.

However, as Jonas has noted, if one slides the pawn from e2 to e4 (meaning the pawn makes a stopover at e3 as well) it does not work. It currently double beeps and shows a white move instead of a black one. The Pycochess tree handled this by taking the first event and waiting a second until the dgt events are done. Similar logic waiting for a "quiet" period might be applicable here. Sliding pieces is a common method to input moves.

jromang commented 10 years ago

If you read this : thanks for the test Jonas ! Managing this was a little tricky as a wanted to avoid a timer to keep the board's reactivity. Here is how this is now handled : a search is started just after a legal move with no delay, but it is interrupted as soon as a new legal move is detected while the engine is searching, and a new search is started with the new position. Here is the commit : 75358a54124ed8784b778e31806db751b3f3eaed