douglasbagnall / p4wn

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

Fix for issue #6 #7

Closed chanibal closed 12 years ago

chanibal commented 12 years ago

Also added a fix to the interface

douglasbagnall commented 12 years ago

Thanks Chanibal.

I will merge this for now.

I have been meaning to remove the pawn promotions from the state altogether, and have the preferred promotion as a third argument to p4_move (i.e. p4_move(s, e, promotion)). That makes keeping track of the currently selected promotion a job for the interface not the engine, which is pretty much what your 65f341b238bda4077c83f64d6c3b503bbf1358d4 commit does anyway. The engine has no business knowing the players intentions.

The history only needs to record the promotion for the current move, so it becomes a list of [s, e, promotion] lists, just right for p4_move.apply().