DEV Community

lsweet
lsweet

Posted on

My First Python Project

Image description

As my final project in the Codecademy CS101 course, I've written a terminal chess game in python called simple_chess. It presents the user with a simple chessboard visualization in the terminal. Play proceeds as players enter their moves into the terminal and the program updates the visualization with the new moves and removes captured pieces. When a player decides to end the game, they type "end game" into the terminal on their turn and receive a pgn printout of their chess game.

The program is still rudimentary and does not check moves for legality, detect checks and checkmates, or support special moves such as en passant, castling, or pawn promotion. Adding these features will certainly be on my to-do list if I return to this project in the future.

A key principle that I learned as I worked on this project is the power of object oriented programming. Initially I defined classes for each type of chess piece but the chessboard itself was managed with a series of dictionaries and lists. As I started to work on a chessboard visualization system, it occurred to me that I could also define a square class for squares on the chess board. This greatly simplified the visualization system. I haven't gone back through the code that I had written previously to update all features that involve locations on the chessboard to use the square objects, but that will also be on my to-do list should I return to the project in the future.

Creating simple_chess was an enjoyable challenge and a great learning experience for me. I'm excited to see what's next!

Top comments (2)

Collapse
 
usamaa profile image
Osama B.Sassi

Great job and congratulations on completing your first Python project. You can now upload your project to GitHub and maintain documentation for your upcoming enhancements. Simultaneously, this serves as a valuable backup in case of any issues and allows you to revert to previous versions. Moreover, you have the opportunity to present your work to the global developer community, gaining recognition and fostering collaborations for future projects. Undoubtedly, this will significantly enhance your portfolio of achievements.Good luck in your Python journey ❤️

Collapse
 
lrvsweet profile image
lsweet

Thanks Oussama! I appreciate you taking the time to read my post and share some feedback.