Skip to content

jonathonireland/pythonChess

Repository files navigation

Data Persistent Two-Player Chess

Project Synopsis

Now that data is captured for every aspect for a chess game, I am going to continue pursuing short term development plans.

Pawn Promotions

Pawn Promotion image

Long Castling (on the queen's side)

Long Castling

Both Castle Options

Picture shows white side of the board with both castle options

Shows 128 Moves

Shows 128 Moves on the right rectangle box

Game Over

black won the game! Persistent Two-Player Chess

En passant

En Passant allows a pawn to capture after moving diagonally behind an opponents piece. The highlighted square in the graphic here shows that the white pawn can move diagonally and then capture the black pawn behind it.

En Passant allows a pawn to capture after moving diagonally behind an opponents piece. The highlighted square in the graphic here shows that the white pawn can move diagonally and then capture the black pawn behind it.

This screen shot shows that the captured black pawn is no longer on the board after the en passant move takes place.

This screen shot shows that the captured black pawn is no longer on the board after the en passant move takes place.

This Pygame development I started in December of 2023 because of an interest in learning Python (and) I have always thought Chess was fun. It quickly became an obsession in completing the tutorials below... It has not stopped there though, I don't know where this will end up, it's only for fun, so it doesn't have to stop.

  1. https://www.youtube.com/watch?v=X-e0jk4I938&t=7481s
  2. https://www.youtube.com/watch?v=s2Dd_obh3fM&t=134s

Those two tutorials were a great foundation to begin experimentation and learning in Python. Once they were completed, I began to start coding ideas of my own for the game, and I still am developing new features.

Working through development plans.

Obvious changes in the game's interface:

  • listing out the moves made through the game next to the pieces that were captured

New coding features include:

  • adding (and inserting into) a "games" table for each game.
    Select * from games ORDER BY id DESC LIMIT 10 shows that the games table is probably the least imaginative table but it is the base building block upon the games data is started with.
    Select * from games ORDER BY id DESC LIMIT 10 shows that the games table is probably the least imaginative table but it is the base building block upon the games data is started with.
  • adding (and inserting into) a "gameMoves" table for each move
    Select * from gameMoves ORDER BY id DESC LIMIT 10 shows that game successfully creates a move associated with a specific game that includes the piece, starting position, ending position, and color.
    Select * from gameMoves ORDER BY id DESC LIMIT 10 shows that game successfully creates a move associated with a specific game that includes the piece, starting position, ending position, and color.
  • adding (and inserting into) a "gameCaptures" table for each capture
    Select * From gameCaptures limit 10 shows that game successfully logs captures when playing the game.
    Select * From gameCaptures limit 10 shows that game successfully logs captures when playing the game.
  • adding (and inserting into) a "gameChecks" table for each check inserts completed in gameChecks
  • adding (and inserting into) a "gamePromotions" table for each pawn promotion.
    select * from gamePromotions ORDER BY id DESC LIMIT 10 shows that there is room for improvement here, the ids for the promotion do not increment as they should due to the game looping while the insert is happening.
    select * from gamePromotions ORDER BY id DESC LIMIT 10 shows that there is room for improvement here, the ids for the promotion do not increment as they should due to the game looping while the insert is happening.
  • adding (and inserting into) a "gameCastling" table for each castle. There is room for improvement here, would like to (possibly) capture the starting position of the king and rook and then their position after they complete the castle maneuver
    select * from gameCastling ORDER BY id DESC LIMIT 10 shows that castle moves are captured and associated with a game move id.
    select * from gameCastling ORDER BY id DESC LIMIT 10 shows that castle moves are captured and associated with a game move id.
  • adding (and inserting into) a "gamesCompleted" table for every completed game. select * from gamesCompleted; shows that the game is recording completd games that result in a winner.
  • Fixed Game Reset after Forfeit button is clicked!!

Short-term Development plans:

  1. Load a list of games from persistent Data
  2. Select a game from the list and load all game moves played already.
  3. Give option to save game or delete it.
  4. Give an option to re-name a game.
  5. Give an option to add notes to the game.

To run this on your local (on Mac OS 13 or newer)

  1. Install Python 3.12.0 or newer.
  2. Install MySQL 8.0.34 or newer.
  3. Create a db_connection.py file in the root of the pythonchess folder.
  4. Copy and paste stored_procedures.sql and run the structured queries.
  5. Run the main.py file to start the game.

About

Python Chess Game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages