Skip to content

[feat]: Develop Two-Player Chess Game in Python #360

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added PYTHON APPS/Chess/Images/Highlight.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/PromotionMenu.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/bB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/bK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/bN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/bQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/bR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/bp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/chess.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/chess1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/dtb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/logo1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/ltb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/royal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/wB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/wK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/wN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/wQ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/wR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PYTHON APPS/Chess/Images/wp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions PYTHON APPS/Chess/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Two Player Chess

This is a simple two-player chess game built in Python. It uses the standard rules of chess and allows two players to play against each other on the same computer.

## Installation

To install and run the game, follow these steps:

1. Clone the repository to your local machine.
2. Navigate to the project directory in your terminal.
3. Install pygame , a Python library for creating games, by running the following command:

```
pip install pygame
```

4. Start the game by running the following command:

```
python main.py
```

## How to Play

The game is played using the standard rules of chess. Each player takes turns moving their pieces on the board until one player is in checkmate or a draw is declared.

To move a piece, select it with your mouse and drag it to the desired square. If the move is legal, the piece will be placed on the new square. If the move is not legal, the piece will return to its original position.

## Features

- `En Passant`: Special pawn capture move inclusion
- `Castling`: Ability to perform the castling maneuver
- `Checkmate and Stalemate Detection`: Logic for detecting game-ending states
- `User Interface`: Graphical representation of the board with mouse controls
- `Standard Chess Rules`: Adherence to traditional chess rules
- `Two-Player Mode`: Enable two human players to compete on the same device

## Code Overview

The game is built using two Python files:

- `engine.py`: This file contains the logic for the chess game, including the rules for moving pieces and checking for checkmate and stalemate.
- `main.py`: This file contains the user interface for the game, including the graphical representation of the board and the mouse controls for moving pieces.

Build with :heart: by [Purna Shrestha](https://github.com/purnasth)
Loading