# White king and rook vs black king chess endgame

Heuristic Search for the White Rook and King versus the Black King Chess Endgame
Individual Project

The goal of the project to develop a software system that solves White Rook and King versus Black King Chess Endgame Problems (WRKBK for short). The steps of the project include:
0. Familiarize yourself with the WRKBK-problem and how to solve it “as a human”.
1. Implement the state space of the WRKBK-problem.
2. Select a search strategy and implement it! (use breadth first search, depth first search, A* search, or best first search)
3. Augment the search strategy with problem-specific knowledge!
4. Run the implemented system for the training benchmark.
5. Remove bugs from your implementation and enhance your search strategy and the problem specific knowledge it uses based on the experience of Step 4.
6. Repeat steps 4 and 5 until a satisfactory software system has been obtained.
7. Write a short report that summarizes your employed search strategy, the running of your program for the training benchmark, and gives a brief history of the project.
8. Be prepared to demo the software system you developed.
It is assumed that white has to move first. Your objective is to capture the black king (stale mate has to be avoided). It is assumed that the fields on the chess board are represented as pairs of integers, where the first coordinate is assumed to be the x-coordinate, and the second coordinate is the y-coordinate: (1,1),(1,2),…,(8,8).
Our version of the game is deterministic in the sence that black’s move is completely determined for a given position. The black king’s first priority is to capture an unprotected rook. If this is not possible, it is assumed that the black king moves to a safe field (a field is safe, if it is neither in the reach of the white rook nor in the reach of the white king) for which the following value is minimal:
|x-5|*5 + |y-5|*3 + (x+y)*0.1

If there is no such safe field the game ends. If the black king is attacked by the rook this is called a mate (which is a winning position for white); if the black king is not attacked but cannot move to a safe field this is called a stalemate (which is a draw and has to be avoided, when playing the white pieces).
Test your system for the following WRKBK Training Benchmark (PROVIDED AT THE END OF THIS DOCUMENT), consisting of 13 test cases; the training testcases are ordered by degree of difficulty: do not get too disappointed, if your software system has some problems with some test cases with high numbers.
Develop an interface to your program so that it can read a set of example problems from a file, and then solves all problems in the file, and generates an output file containing solutions (and background info about the obtained solutions) for the problem set of the input file. In general, Project1 input-files of the following format:
number of games to play(integer)
newline
name of the test case(4 asci character)
newline
starting position (8 lines — see example)
empty_line
newline
name of starting position(4 asci character)
newline
starting position (8 lines — see example)
empty_line