Overview This assignment is an opportunity to implement the game AI algorithms described in class on a classic 2-player game: Checkers! The goal of this assignment is to solve a series of checkers endgame puzzles, where a winning solution can always be found, given a strong enough AI. The history of Checkers AI is a great story, and a Canadian one as well! Check out the following article for the full tale: How Checkers Was Solved Links to an external site.. How the Game Works Checkers is a 2-player board game played with distinct pieces, where one player’s pieces are black and the other player’s pieces are red. The standard version of the game is played on an 8×8 chess board. The players take turns moving pieces on the board, with the red player typically moving first. Moving and capturing pieces are dictated by the game’s rules. An overview of Checkers is provided here Links to an external site.. We will be coding the version of Checkers called Standard English Draughts, which includes mandatory captures. The full rules of the game are explained here Links to an external site., but the quick summary is: • Objective: Each player’s goal is to capture all of their opponent’s pieces. • Game Ending: The game ends when one of the players has no pieces remaining or has no legal moves left. In that latter case, if it’s a player’s turn but they can’t move any of their pieces, that player loses the game. • Setup: At the beginning of the game, one player has 12 red pieces and the other player has 12 black pieces. The pieces are placed on the dark squares of the board across the first three rows on each side (Figure 1. at left). For this assignment, your AI will play the red pieces moving up the board while our AI will play the black pieces moving down the board. The red player (that’s you) makes the first move. • Moves: o Each piece can only move forward diagonally in two ways: ▪ Moving one space, if the adjacent space is empty (Figure 1, at left), or ▪ Moving two spaces if the adjacent space is occupied by the opponent, and space beyond that is empty (Figure 1, in the middle). o In the second case, the player ’captures’ the opponent’s piece that was jumped over. o Multiple captures: ▪ If a move leads to capture, and the piece ends up sitting at a position that can jump over another opponent’s piece, the player can move it again and capture another piece of the opponent (Figure 1, at right). ▪ This sequence of moves does not need to be on a straight line and can be ’zigzag’. o Kings: ▪ When one of the pieces reaches the opponent’s end of the board (the last row, or the first row from the opponent’s side), it turns into a ”king” and will be granted a unique power: it can move both forward and backward. We recommend that you start this assignment by playing some games of checkers to develop a better understanding of how the game works and what strategies can give you an advantage. An online version of the game that allows you to compete against an AI can be found at this link Links to an external site.. What you need to do You will implement an AI agent that can solve a checkers endgame puzzle, where the agent uses minimax, alpha-beta pruning, and any additional techniques of your choosing. Your agent will return the best move possible, given the endgame puzzle we provide and the time available. We will use multiple endgame boards to test the correctness and performance of your implementation. An endgame is a board configuration where a winning solution is guaranteed, given the right set of moves. These are considered challenging because the solutions are not obvious or require a large number of moves to arrive at. Evaluation Your solution will be marked based on the number of moves your AI agent takes to end the game (compared to the optimal number of moves from a perfect AI agent). When counting the number of moves (also called the solution length), we will count moves from both your agent and the opponent. For example, if your agent takes 4 moves to end the game with the opponent taking 3 moves in between, the total number of moves would be 7. Input Format The board configuration will be provided in text files with names input0.txt, input1.txt, etc. Each line in this input file will represent a row from the checkers board, with 8 characters in each row, one for each square on the board. There are 5 possible values for these characters: • ’r’ denotes a red piece, • ’b’ denotes a black piece, • ’R’ denotes a red king, • ’B’ denotes a black king, and • ’.’ (the period character) denotes an empty square. • As an example, the contents of the file puzzle1.txt is as follows: …….. ….b… …….R ..b.b… …b…r …….. …r…. ….B… For these puzzle layouts, assume that your AI controls the red pieces and that it’s the red player’s turn to move. Your main program should take two command-line arguments: one for the input file and one for the output file: python3 checkers.py