Final Report
Final Report
1
Chapter 1. Introduction
1.3 Keywords:
Chess, hierarchy, templates, GUI, inheritance, Artificial Intelligence,MinMax
Searching, Alpha-beta Pruning, Python.
2
CHAPTER 2
3
Chapter 2. Proposed Objective
This project implements a classic version of Chess using Python and a graphical user
interface. The game of chess follows the basic rules of chess, and all chess pieces move
only according to the moves allowed for that piece. My implementation of chess is for
two players. It is played on an 8x8 checkered board, with each player having a dark
square in the lower left corner.
4
CHAPTER 3
5
Chapter 3. Requirement Specification
These are some of the specifics on which my project is based and following my "Chess
Game Design" was able to proceed as follows:
6
CHAPTER 4
7
Chapter 4. Existing Syatem
In the context of a chess game project using Pygame, "current system" refers to the state
of the chess game implementation prior to the development of the current project.
Because this is a specific implementation and not an upgrade to existing software, the
term "existing system" may not be directly applicable. Instead, the literature review
provides an overview of relevant current work, frameworks, or project-related
techniques.
9
CHAPTER 5
10
Chapter 5. Characteristics
In this scenario, we present the basic definition of chess moves. Before starting the
game, we need to know what it is and what it is known for.
Chess: The game is played by 2 people on a backgammon board with 16 pieces each.
Player or User: The user or player will be the person who plays chess.
king: The main part of the game is to check the artifacts of this game object. Can
move 1 space in any direction.
Knight: This piece can move 1 space vertically and 2 spaces horizontally or 2
spaces vertically. This work looks like a horse. This work can also jump through other
parts.
Queen: This piece can move in any direction in any space unless there is another
piece.
Rook: one of two pieces of the same color that can move the number of
squares horizontally or vertically, unless another piece interferes.
Bishop: one of two pieces of the same color that can move any number of squares
diagonally, unless another piece interferes. One piece always remains in the White Box
and the other always in the Black Box. The bishop does not have restrictions on each
move, but only on diagonal moves. The bishop, like all pieces except the knight, cannot
jump over other pieces. The bishop occupies a square occupied by one of the enemy
units.
Bishops can be distinguished by the wing that starts with, which is the bishop of the
king and the bishop of the queen. As a result of the diagonal movement, each bishop
always remains in the white or black square, so it is also commonly called a light or
dark colored bishop.
Check: Perform an action that immediately attacks the opponent's King. In chess,
check occurs when a player's king is in danger of being captured by his opponent's next
turn. A king so threatened said in control. If possible, the player must move out of check
by adding a piece between the threatening piece and the king, capturing the threatening
piece, or moving the king to a square that is no longer controlled. If the player fails to
check out, the game ends with a partner and the player who loses. Players cannot make
moves that control their king.
11
Scout: keep the opponent's king under control and avoid capture. He then brings the
game to a winning conclusion.
Castling: move the king two squares diagonally and bring the joker to the area
where the king passed. Casting is a movement in chess involving the player's king and
the player's original piece. A rook is the only move by the player that two pieces move
in the same move, and the only move where one piece of the knight's move can be
called "push" for another.
Casting consists of moving the king two squares to the hole of the player's first level,
then moving the king to the next square. Casting is only controlled if the king has never
moved, the castle involved has never moved, the square between the king and the castle
is not occupied, the king is not in control, and the king has not passed or finished the
square. Casting is one of the rules of chess and is technically a king move.
Stalemate: A situation where one player's king is not in control, but the player
cannot move. Then the results are inconsistent.
12
5.2.6 Additional Functionalities:
Game Mode Selection: Users can now choose between single-player
and multiplayer modes, providing flexibility and catering to different
preferences in gameplay.
13
CHAPTER 6
14
Chapter 6. Proposed Methodology:
15
6.6 Event-Driven Programming: Embracing an event-driven
programming model within the Pygame loop will ensure responsiveness to
user actions and facilitate seamless execution of game-related events. Event
handlers will be utilized to manage user inputs, trigger graphical updates,
and synchronize gameplay elements, ensuring a smooth and immersive
gaming experience.
6.7 Comprehensive Game State Management: A robust game
state management system will be developed to accurately track the state of
the game at any given time. This includes managing game modes, tracking
timers for timed matches, enforcing turn-based gameplay rules, and
implementing error handling mechanisms to provide informative feedback to
users in case of invalid moves or unexpected scenarios.
6.8 Special Moves Handling: Special moves handling will be
expanded to cover a wide range of scenarios, ensuring compliance with the
rules of chess. This includes implementing logic for special moves such as
castling, en passant captures, and pawn promotions, with careful
consideration for their impact on game dynamics and strategic decision-
making.
6.9 Testing Strategy Augmentation: A comprehensive testing
strategy will be devised and implemented to verify the correctness and
reliability of newly introduced functionalities. This will involve conducting
unit tests to validate individual components, integration testing to ensure
seamless interaction between modules, and error handling tests to assess the
robustness of the application under various scenarios.
16
6.11 Alpha-beta Pruning:
This common pruning function is used to considerably decrease the min-max
search space. It essentially keeps track of the worst and best moves for each
player so far, and using those can completely avoid searching branches
which are guaranteed to yield worse results. Using this pruning will return
the same exact moves as using min-max (i.e. there is no loss of accuracy).
Ideally, it can double the depth of the search tree without increasing search
time. To get close to this optimum, the available moves at each branch
should be appropriately sorted. The sorting is done by the looking at the
scores of each possible move, looking only 1 ply ahead. The intuitive sort
would be to arrange them from best to worst, but that's not always best. Most
moves in chess end up being ones with small gains and losses (ones that
improve position, not necessarily capturing pieces), so it makes sense to
order the "stand pat" moves first. So the sorting is based on the absolute
value of the move scores (with the smaller ones coming first). The average
branching factor for min-max in chess is about 35, but with the alpha-beta
pruning and sorting, the program achieves a branching factor of around 25.
17
CHAPTER 7
18
Chapter 7. System Design
19
7.2 Game Flow Diagram
20
7.3 StateDiagram:
PIECE MOVE
21
CHAPTER 8
22
Chapter 8. Feasibility Study
Based on the the initial investigation conducted using the ChessAI and
ChessMain projects as references, the feasibility of developing a new chess engine
integrated with a graphical user interface (GUI) can be assessed. The primary objective
of the feasibility study is to evaluate the technical and operational viability of the
proposed project.
Integration with Pygame: Integrating the chess engine with a GUI built using
the Pygame library allows for the creation of visually appealing and interactive chess
interfaces. Pygame's extensive features for graphics rendering and event handling
facilitate seamless integration with the underlying chess logic.
23
8.2.1 User Interaction:
Intuitive GUI: The graphical user interface enables users to interact with the
chess engine through intuitive mouse clicks and keyboard events, enhancing the overall
user experience.
24
CHAPTER 9
25
Chapter 9. Proposed Evaluation Method
9.1 User Interface: The graphical user interface (GUI) significantly improves
the user experience compared to the previous text-based interface. The evaluation will
consider the clarity, intuitiveness, and overall user-friendliness of the GUI. The system's
ability to engage users and make chess gameplay visually appealing will be assessed.
9.4 User Interaction: The user-friendly interface aims to provide players with a
positive and enjoyable experience. The evaluation will consider how well the system
engages users, the ease of making moves, and the overall satisfaction of the gaming
experience. Visual cues and highlights for possible moves will be evaluated for their
effectiveness.
26
CHAPTER 10
27
Chapter 10. Testing
Testing Testing is a process, which reveals error in the program. It is a major
quality measure employed during software development. During testing the program is
executed with a set of test cases and the output of the program with test cases is
evaluated to determine if the program is performing as it is expected to perform. In
order to make sure that the system doesn’t have errors there are the different levels of
testing strategies which are applied at different phases of software development .
28
• Reliability Testing: Rigorous verification of the application's reliability
by analyzing its ability to maintain consistent performance over extended
periods.
• Security Testing: Ensuring the security of user inputs and preventing
unauthorized access or manipulation of the game state.
29
CHAPTER 11
30
Chapter 11. Project Snapshots
11.1 Chess-Board:
31
11.2 Highlighting Legal Moves:
32
11.4 Drawing Captured pieces:
33
CHAPTER 12
34
CHAPTER 12. Future Proposed System
As we look forward to the future of the Python Chess Game with the implementation of
ChessAI, the goal is to enhance both its intelligence and accessibility, making it a
leading choice for chess enthusiasts of all levels. The following features outline the
roadmap for the future development of the system:
Analysis Tools: Integrate analytical tools that provide insights into the AI's
thought process, allowing players to learn and grow from their games.
Intuitive Interface: Redesign the user interface to be more intuitive and user-
friendly, drawing inspiration from ChessMain's interface design principles.
35
Web Integration: Create a web-based version of the game that can be accessed
through internet browsers, enabling seamless gameplay across desktop and mobile
devices.
36
CHAPTER 13
37
CHAPTER 13. Conclusion
38
List of References
39