Pythons on a Battleship (a terminal game)

My first solo python and portfolio project… Battleship!

This project challenged me to deep dive into ‘while’ loops and eventually led me to place print statements after every function so I could understand what was happening and debug at one point. I also learned the use of input functions and cleaned up print statements by using f-strings.

Any and all feedback would be appreciated! Thank you!

Git Hub Repository:

Blog Post:

Heya! I recently did a battleship game as well and would love a bit of feedback IF you get a chance! For now, here’s the feedback from your project!

  • Did you consider separating out your classes into a separate file? I found that doing so and then importing them made it a bit easier to separate the class logic from the actual gameplay loop logic.

  • I like the way you track the status of your ships!

  • You do a great job of input validation! I’d love to see that after each input the game space gets “re-rendered” though, otherwise multiple bad inputs force me to scroll up and see the board again.

  • Having some sort of loop after each input to clear the screen and render what you want to show again would help a bit with readability

  • Your last column is labelled 0, rather than 10. While I get that this was probably done because 10 would be 2 character wide and 0 is only one character, it makes things a bit awkward. Would starting with 0 instead of ending with 0 make sense? Alternatively, you could alternate column and row headers (so all columns are a letter, and all rows are a number) which would also solve this problem and allow you to use 10

Thank you for the reply! You make some great points and utilize them well in your own project. Honestly, a lot of it comes down to the UI, but I’ve come to realize that’s just as important as the backend and something we often take for granted. Grouping classes and functions into separate files, constantly refreshing the board instead of letting a bunch of lines stack up, and something as simple as rearranging the grid’s numbering are all great suggestions!

Your blog post is well-organized and provides a clear explanation of your process, making it easier to understand compared to dissecting the code, so I apologize for you having to deal with my beginner formatting. You demonstrate a solid foundation in organizing and cleaning up code, even as a beginner. I appreciate the knowledge greatly and will try my best to provide you with the same.