The code solves a popular board game that helps learning chess. The pieces used in the game act in the same way as chess.
The game consists of a rook, which represents a wolf, and 8 pawns which represent sheep. The rook moves exactly the same way as it does in a chess game, it can move anywhere vertically and horizontally, and the pawns can only move forward, and block the rook from going to the two same colour squares in front.
For the wolf to win he has to take out all the sheep. The sheep win once one of them reaches the 8th row of the board.
The algorithm used to solve the problem is the minmax algorithm.
video_salida.mp4
The following video ilustrates how the minmax algorithm works.
MinimaxIllustration.mp4
- Python
- C
- ast