Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β™” Python Chess β™š

A fully functional, interactive chess game built using Python's Tkinter library. This GUI-based application allows two players to play classic chess with move validation, check/checkmate detection, and visual indicators for selected pieces and legal moves.

🧩 Features

  • 🏁 Start Screen with stylized UI and chess piece decorations
  • β™Ÿ Drag-free click-to-move piece mechanics
  • βœ… Highlights legal moves in green
  • 🚨 Highlights the king in red when in check
  • β™” Check and Checkmate detection
  • πŸ”„ Restart game or return to main menu
  • πŸ’‘ Suggested move logic (code retained, not exposed in UI)
  • πŸ“± Responsive Tkinter UI optimized for 600x700 window

πŸ›  Installation

  1. Make sure Python 3 is installed.
  2. Clone this repository or download chess.py.
git clone https://github.com/your-username/python-chess-tk.git
cd python-chess-tk

Run the game:

python chess.py

πŸ“‹ How to Play Click on a chess piece to select it.

Legal destination squares will highlight in green.

Click on one of the highlighted squares to make your move.

When a king is in check, the square turns red.

The game ends when a checkmate occurs.

Use the top control buttons to return to the menu, start a new game, or exit.

πŸ“¦ Dependencies Python standard library only

tkinter (included with most Python distributions)

πŸ” Code Structure ChessApplication: Manages UI navigation between start screen and the game

ChessGUI: Handles board creation, rendering, move validation, check/checkmate detection, and turn logic

Internal utility methods manage:

Piece movement rules

Legal move generation

King safety checks

Stalemate and checkmate detection

🧠 Game Logic Highlights Accurate handling of movement rules for all standard chess pieces

King position tracking and attack path analysis

Visual feedback for all game states

Prevents illegal moves that expose the king to check

Detects endgames including checkmate and stalemate

πŸ“œ License This project is licensed under the MIT License. You are free to use, modify, and distribute it as you like.

🀝 Contributing Contributions, bug reports, and feature requests are welcome. Feel free to fork the repository and open a pull request.

About

Chess - Python Based Chess Game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages