diff --git a/README.md b/README.md index f666234..f8f67c9 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,20 @@ For search we stuck to a recursive minimax with alpha-beta pruning. This impleme We used a simple variable depth solution. We have a minimum and maximum search depth such that the minimum is always met and the search will continue to the maximum depth as long as there are jumps available. With this we could achieve a maximum ply of around 11 in a couple of seconds. The minimum depth of 5 ensured that pieces wouldn't hover around corners during endgame as 5 moves is often enough to encounter another piece which was combined with higher evaluation values on encounters rather than avoidance. +## (2) Features Used for State Evaluation + +When evaluating the value of a state, we implemented various heuristics to assess the quality of that state. We decieded to minimize white and maximize black, that is the a heuristics valuing white would be more negative while for black it would be on the positive side. All the heuristics can be viewed in the `src/Heuristic.cpp` file. + +### Heuristic Function + +The first heuristics implemented were on the more basic side of evaluating a state. Pawn count simply calculated a value for the difference between the number of pawns (black - white as this produces a negative value when white has more and a positive when black has more). We used this same formula for kings except added an extra weight, multiplying the difference between black and white kings by 1.5. We also implemented another set of heuristics for both kings and pawns by determing the number of 'safe' pieces, pieces that were on the edge of the board and could not be jumped. + +After having values representing the number of pieces comparitively on the boardm, we moved on to looking at the position of the pieces and giving value to those in certain positions. We created a heuristic for the number of defending pieces of either black or white, that is, the number of pieces in the first two rows of that colors starting side. We also created an attacking heuristics representing the number of peices in the opponents first three rows. + +We also wanted to measure how close or available a pawn promotion was. We acheived this by calculating the distance each pawn was from the opponents first row (the promotion row) and summing them up. We believed it wasn't enough just to have this raw number as other pieces may have been impeding pawns from being promotion so we created another heuristic known as openPromotion. This counted the number of open spaces on the promotion row, i.e the opponents first row. + +Finally, we wanted values for which pieces were able to make moves and which pieces were able to make jumps. For which pieces were able to make a move, we counted how many moves each pawn and king could make and simply summed them up. This, however, only considered direct moves, not jumps, as it searched the surrounding piece for an open space. To search for a jumpable piece, we had to look at whether there was an oppinent in the direct path of a piece and whether then whether a jump over that opponent was possible. + ## Citations The vast majority of the project is personal work but there were some inspirations and little tricks from various sources. Any code directly copied from a source like StackOverflow is stated inline in comments. An exhaustive list of all sources used is here: