Author: | kobi |
---|---|
Mode: | factor |
Date: | Mon, 19 Apr 2010 06:30:27 |
TUPLE: position { x integer } { y integer } ; TUPLE: chess-position < position { piece piece initial: f } ; : [+|-] ( step ? -- [step+/-] ) [ + ] [ - ] ? curry ; ! direction words are based on the player's view, changing structures is based on absolute board view. : right ( chess-position n -- chess-position ) over white? [+|-] change-x ; ! white is plus, black is minus : left ( position n -- position ) over white? not [+|-] change-x ; ! black is plus, white is minus ! ...
Author: | kobi |
---|---|
Mode: | factor |
Date: | Mon, 19 Apr 2010 07:32:33 |
: [+|-] ( step ? -- [step+/-] ) [ + ] [ - ] ? curry [ call( x -- x' ) ] curry ; inline