-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.txt
10 lines (10 loc) · 3.28 KB
/
report.txt
1
2
3
4
5
6
7
8
9
10
This software is designed to play and analyze chess games using the principles of artificial intelligence (AI) and object-oriented programming. A variety of interconnected classes are brought together to create a robust system.
At the center of the software is the 'Game' class. The 'Game' class manages the entire chess match. It holds the essential components of a game: the 'Board' and the 'Players'. The 'Board' class represents the chessboard in a matrix-like format, but as a one-dimensional array of Square objects. Each Square object can contain a 'Piece', symbolizing the squares on the actual chessboard.
The 'Game' class also contains two instances of the 'Player' class, representing the two opponents, typically designated as 'White' and 'Black'. These 'Player' objects possess a collection of 'Piece' objects. These 'Piece' objects can be various types such as 'General', 'Dragon', 'Catapult', among others, each with its unique movement rules and abilities.
The 'Piece' objects are the soldiers of the battlefield, each capable of executing actions. Actions are operations that change the state of the game, for instance, moving a piece from one tile to another or eliminating an opponent's piece.
An important part of the software's decision-making mechanism is the evaluation of the board states. Each 'Player' object is equipped with an 'EvaluateGame' method. This method calculates a score for the current state of the board from that player's perspective. The score is a heuristic that indicates the favorability of the position, considering various factors such as material advantage (the total value of pieces owned by the player) and the safety of the king.
To make a move, the software needs to determine the legal moves in a given position. Each Player object provides CanMoveTo and CanAttack method, which generates a list of all legal Actions. The method takes into account the unique movement rules of each piece type. The 'Player' class collates these legal moves from all its pieces, thereby producing the list of all possible actions it can perform in a turn.
However, selecting the best move from the list of all possible actions is a complex process. This is where the 'Minimax' function comes in. This recursive algorithm delves into potential future game states, exploring the tree of possibilities up to a certain depth. The 'Minimax' function uses a strategy of minimization and maximization, where it tries to minimize the possible loss for a worst-case scenario and maximize the potential gain in the best-case scenario.
In addition to this, the software employs a pruning technique known as alpha-beta pruning. It reduces the computation by ignoring positions that are unlikely to influence the final decision, therefore improving the efficiency of the search.
Finally, if a checkmate situation is possible, it is prioritized as the most desirable outcome. The 'GetCheckmateAction' function scans all possible actions and checks if any of them results in a checkmate, a situation where the opponent's general is in a position to be captured (in "check") and there is no way to remove the threat.
Overall, this software is an elaborate assembly of interconnected parts in a game of chess. It balances between strategic depth and computational efficiency to provide a challenging chess-playing experience.