tp

Project Portfolio: ChessMaster

Overview

I implemented the main game logic, including the Minimax class and algorithm which serves as the backbone for the CPU, as well as move logic for the individual chesspieces. These classes dictate the precise functioning and internal logic of the game. My responsibilities extend to detailing documentation for these gameplay features, and for ironing out bugs and issues that might arise from the progressive integration of these features into the game.

Contributions

Minimax Class and Algorithm

The Minimax class and algorithm is the backbone of the CPU. It is responsible for determining the best move for the CPU to make, and is the core of the CPU’s decision-making process. The Minimax algorithm is a recursive algorithm that searches through the game tree, and is used to determine the best move for the CPU to make. The Minimax class is responsible for the implementation of the algorithm, and is the class that is called by the CPU to determine the best move to make. I implemented the algorithm with SLAP and extracted helper functions to improve the readability of the code.

Difficulty

The difficulty of the game is determined by the depth of the Minimax algorithm. The higher the depth, the more moves the CPU will look ahead, and the more difficult the game will be. The depth of the Minimax algorithm can be set by the user in the savefile and when starting a new game. The maximum depth is set to 3, as the CPU will take a long time to make a move if the depth is set too high.

The difficulty is also saved in the savefile, and is loaded when the user loads the savefile. I implemented this feature by adding a new field in the savefile, and by adding a new parameter in the Game class to set the difficulty of the game. This was added in the style of the existing parameters in the Storage class.

Move Validity

The move validity of the chesspieces is determined by the isValidMove() method in the ChessPiece class. This method is called by the Game class to determine if a move is valid. The isValidMove() method is implemented in the child classes of the ChessPiece class, and is responsible for determining if a move is valid for the chesspiece.

I implemented this alongside various non-standard chess moves, such as castling and en passant in a manner that minimised code coupling and enabled other developers to have a more bug-free experience.

Reposense

My code contributions can be found on the TP Dashboard.

Project Management

I solved bugs and issues that arose from the integration of the Minimax algorithm and the move validity of the chesspieces. I also managed the bug testing and checkstyle adherence, and delivered key features in a timely manner which allowed for other developers to have a longer runway for implementing their features.

Documentation

Developer’s Guide

I documented the Minimax class and algorithm with a sequence diagram, as well as the Move class and the various types of moves available. I also added a sequence diagram and a class diagram of the Move class.

User’s Guide

I added documentation in the user guide for castling and en passant, as well as the difficulty of the game. In addition, I polished and edited the user guide to make it more comprehensive about the various features ChessMaster has to offer.

Team-based tasks

I added several issues and reviewed several PRs, and helped to manage the project board. An example can be found in this pull request and in this issue. I also submitted various bugs for other teams such as here.