douglasbagnall / p4wn

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

castling under check (2) #5

Closed yelizariev closed 12 years ago

yelizariev commented 12 years ago

It look like new src/engine.js come back to old bugs: "r6r/p3kp1p/4np2/1Bb5/3p4/P4N2/1P3PPP/R3K2R w KQ - 2 18" "r3k2Q/pp3p1p/3qp3/2pp2N1/3P4/4PP2/PP1K2PP/nNB4R b k - 0 15"

Please check it.

douglasbagnall commented 12 years ago

I don't think this is a regression. The "r6r/p3kp1p/4np2/1Bb5/3p4/P4N2/1P3PPP/R3K2R w KQ - 2 18" (knight masquerading as rook) case is OK as far as I can tell.

The other one (queen on the back row) is definitely a bug and is probably quite old. A queen or rook on the back row on the king side was missed when castling on the queen side. Fixed in commit ba43d5d8ddd8107fb5aae8469cd55030c07019a3.

BTW, this also revealed that p4wn had the FEN representation of king and queen side castling backwards (also now fixed), so the bug should really appear on: "r3k2Q/pp3p1p/3qp3/2pp2N1/3P4/4PP2/PP1K2PP/nNB4R b q - 0 15"

Also, some other recent changes are a few automated regression tests:

http://p4wn.sourceforge.net/src/auto-test.html

and now you can load a board using the query string. just add ?start=. Like this:

http://p4wn.sourceforge.net/src/index.html?start=r3k2Q/pp3p1p/3qp3/2pp2N1/3P4/4PP2/PP1K2PP/nNB4R%20b%20q%20-%200%2015&player=both