You are browsing as a guest. Sign up (or log in) to start making projects!

Chess in Python Turtle 🐢

  • 7 Devlogs
  • 7 Total hours

A fully functioning chess game in pure Python Turtle.

Ship #1

I built pure chess inside Python Turtle. The entire idea of making a fully fledged game in Python's Turtle seemed absurd, but there is tangible proof now. I'm proud of how I handled the piece moving and square highlighting code snippets; those were really fun to work on.

Here are some tests you can do to see if my project holds up:
1. Try clicking outside the board to move a piece, and you'll see that it doesn't.
2. Try moving a piece outside the board.
3. Try moving kings to squares that opposing pieces see.
4. Try double pushing pawns.

Right now, I haven't added en passant or castling, but a 99% fledged chess game inside Python Turtle is ready for you to play.

  • 7 devlogs
  • 7h
  • 12.05x multiplier
  • 80 Stardust
Try project → See source code →
Open comments for this post

1h 53m 47s logged

Finally, I can say that I’ve built chess—fully fledged chess—in Python Turtle.

I added check, checks, checkmates, and all the logic that makes them up. I also created a new function called has_legal_moves, which takes one parameter to see if the attacker is white.

In total, I defined 11 functions back to back in the Python file. It seems funny, but that’s what was needed.

Thank you, every1!

0
0
11
Open comments for this post

30m 6s logged

Added basic promotions when the pawns go to the opposite side (for now they default to only queen promotions, more coming soon) and right now started working on the final boss of chess programming… Checks and checkmates. Wish me luck!

0
0
7
Open comments for this post

55m 31s logged

Welcome back to my pit of inevitable doom, where I’m trying to build fully fledged chess inside pure Python turtle.

This devlog is because I finally managed to get a glimpse of the sunlight and add the special moves and captures for pawns. Before right now, pawns could only move one step forward no matter the place, and they actually captured by going forward into the enemy. If you play chess, you know it’s not like that.

I have now implemented the following:

  1. Two-step support for pawns going on their first move.
  2. Logic so that pawns cannot capture pieces directly in front of them.
  3. Support for pawns capturing pieces only on their front diagonals.

Follow along if you want to see if I ever get out of this!!! :D

0
0
14
Open comments for this post

47m 2s logged

Added coordinates for the chessboard with a new function called print_coordinates. I also added a bouncer function to check if a piece is trying to move to a square that has a piece of the same color. If it’s trying to capture its own piece, it doesn’t allow the move. I implemented this by creating a new function called is_legal_move.

0
0
30

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…