Source

puzzle_nodes / 13 / README.md

Full commit

Chess Validator

Usage

From the project directory:

bin/move_validator boardfile.txt movefile.txt

where boardfile.txt is an ascii representation of a chess board of the form

bR bN bB bQ bK bB bN bR
bP bP bP bP bP bP bP bP
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
-- -- -- -- -- -- -- --
wP wP wP wP wP wP wP wP
wR wN wB wQ wK wB wN wR

and movefile.txt is a representation of a set of chess moves in algebraic notation of the form

a2 a3
a2 a4
a2 a5
a7 a6
a7 a5
a7 a4
a7 b6
b8 a6
b8 c6
b8 d7
e2 e3
e3 e2

The program will print to stdout LEGAL for legal moves and ILLEGAL for illegal moves. For example the output from the given board and move list is

LEGAL
LEGAL
ILLEGAL
LEGAL
LEGAL
ILLEGAL
ILLEGAL
LEGAL
LEGAL
ILLEGAL
LEGAL
ILLEGAL

NOTE: This program is part of my application to Ruby Mendicant University and will be available after December 18, 2011 on GitHub and BitBucket