https://github.com/ngangawairimu/chess-capture-program
This project is a Python-based interactive chess program that allows users to determine which black pieces can be captured by a specified white piece (either a knight or pawn) based on its position on the board.
https://github.com/ngangawairimu/chess-capture-program
input-validation interactiveprogramming
Last synced: 3 months ago
JSON representation
This project is a Python-based interactive chess program that allows users to determine which black pieces can be captured by a specified white piece (either a knight or pawn) based on its position on the board.
- Host: GitHub
- URL: https://github.com/ngangawairimu/chess-capture-program
- Owner: ngangawairimu
- Created: 2024-11-20T10:52:53.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-21T10:55:25.000Z (7 months ago)
- Last Synced: 2025-01-28T14:52:50.013Z (5 months ago)
- Topics: input-validation, interactiveprogramming
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chess-Capture-Program
This program simulates a simple chess scenario where a white piece (either a knight or a pawn) tries to capture black pieces on the board. Users input the positions of the white piece and multiple black pieces, and the program calculates which black pieces are capturable based on chess rules.
## How It Works:
- The user provides the type and position of the white piece (e.g., knight d4).
- They then input up to 16 black pieces with their positions (e.g., pawn c5).
Validation:
The program ensures all inputs follow proper chess notation (e.g., a1 to h8).
It prevents duplicate positions and supports only valid piece types (knight or pawn).
#### Chess Logic:
For a knight, the program calculates all possible "L-shaped" moves.
For a pawn, it considers diagonal captures one square forward.## Features
User Input:- The user inputs the type and position of a white piece (knight or pawn).
- The user adds black pieces to the board, ensuring proper input format and valid positions.
## Movement Logic:- The knight moves in an "L" shape, and the pawn captures diagonally one square.
- The program calculates which black pieces are in the capturing range of the white piece.
## Validation:- Validates user input for piece types and positions.
- Ensures there are no duplicate black piece positions and that at least one black piece is added.
### Output:Displays the list of black pieces that the white piece can capture, if any.
## Technologies Used
Python (No external libraries required)
Interactive user inputs and outputs in a terminal/console.
## Usage
Run the program, input the white piece and its position, then add black pieces. The program will output which black pieces the white piece can capture.