douglasbagnall / p4wn

a smallish turn-of-the-century javascript chess engine
http://p4wn.sf.net
113 stars 33 forks source link

Game makes moves by itself when swaping sides #10

Closed AdrianLC closed 10 years ago

AdrianLC commented 11 years ago

Hello,

Steps to reproduce:

  1. Open src/index.html
  2. Spam the swap option non stop.
  3. The game will even reach stalemate

Hope it helps.

douglasbagnall commented 10 years ago

Sorry, I thought I'd answered this one already.

This is the expected behaviour.

Here are the steps: Suppose you are playing white, and it is white's turn.

  1. You click swap.
  2. Now you are black and the computer is white, but it is still white's turn.
  3. The computer is white and it is white's turn, so it makes a move.
  4. You are playing black and it is your turn.
  5. You click swap.
  6. Now you are white and the computer is black and it is black's turn.
  7. The computer moves.
  8. it is white's turn.
  9. goto 1.

So I'm closing this. I don't disagree that the current behaviour is unsettling, but I believe it is correct. If you have a better idea, feel free to add it.