Skip to content

Sm3th/ChessGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chess Game

A fully-featured chess game built with Python and Pygame.

Features

  • Two game modes — Player vs Player (same screen) or Player vs Bot
  • Strong AI — Minimax algorithm with alpha-beta pruning (depth 3), piece-square tables for positional evaluation, and MVV-LVA move ordering
  • Smooth animations — Piece movement with smoothstep easing
  • Procedural sounds — Move, capture, check, castle, and game-end sounds generated at runtime (no audio files needed)
  • Drag & drop — Pick up and drop pieces with the mouse; click-to-move also works
  • Full chess rules — Castling, en passant, pawn promotion, check/checkmate/stalemate detection
  • Captured pieces bar — Displays taken pieces and material advantage for each side
  • Check highlighting — King square turns red when in check; status bar tints red
  • Turn indicator — Colored circle + board-edge accent line showing whose turn it is
  • Fullscreen support — Letterboxed scaling for any resolution
  • Promotion dialog — Choose queen, rook, bishop, or knight on pawn promotion

Requirements

  • Python 3.10+
  • pygame 2.x
pip install pygame

Running

python main.py

Make sure the images_chess/ folder is in the same directory as main.py.

Controls

Key / Action Description
Click piece Select and show legal moves
Click target square Move selected piece
Drag & drop Pick up a piece and drop it on a target square
R Restart game
F11 Toggle fullscreen
ESC Return to main menu / quit

Project Structure

ChessGame/
├── main.py          # Game loop, rendering, input handling
├── utils.py         # Board logic, move generation, AI
└── images_chess/    # Piece sprites (PNG, 60x60)

AI

The bot plays as Black and uses:

  • Minimax with alpha-beta pruning at depth 3
  • Piece-square tables for all 6 piece types (positional scoring)
  • MVV-LVA move ordering (captures examined first, ranked by victim/attacker value)
  • Material evaluation using standard piece values (P=100, N=320, B=330, R=500, Q=900)

About

Python/Pygame chess game with minimax AI (alpha-beta, depth 3), smooth animations, drag & drop, sounds, PvP/PvB modes and fullscreen support

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages