How Chess
How Chess
Difficulty: Hard
Along with TicTacToe, nobody solved this problem correctly. And unlike TicTacToe, nobody
even tried to solve this problem.
Our resident genius decided not to write a program in Basic, since it would be extremely long to
code. In fact, his solution in C++ takes over 80 lines of code.
The way our resident genius solved this problem, for each position, he calculated whether or not
each piece lay in the path of another piece. If it did, he would print out that the piece was in danger
by the other piece.
He employed extensive use of Boolean functions, one for each piece type. Knight found if a knight
lay one move away in two lines of code. Bool Bishop found out if a piece laid along it’s diagonals,
and Bool Rook found if a piece laid along a horizontal or vertical line, and Queen found if it was in
the path of rook or bishop.
Well, that’s all the solutions. I hope these made sense to you, and that you can use these
explanations to help train for next years contest. See you all next year!
Ryan McGarry
President of USD ACM
Doug Jennewein
Vice President of USD ACM
\t itha Lurz
Secretary/Treasurer of USD ACM