The Making of Where Are The Ships
As part of the portfolio project given by Codecademy at the end of the first module of Computer Science Career Path, you need to write a technical blog post, so here we are.
My Python Program
It's based on an old guessing game (dating back to WW1). Most people today know the concept from Battleship.
The code is all contained in one file, script.py. And inside, I have created a Game class for playing the game. And a start_screen function to run the start screen.
When the program first runs, the start_screen function will be called, and this prompts the user to choose between three options: play the game, read the instructions, or quit the program. If the user chooses to play the game, a new Game object (new_game) will be created, a message will be printed, followed by the grid. Now the player has 40 turns to find the hidden ships. He can return to the start screen by writing "return" or "r", or quit altogether by writing "exit" or "e".
Check out the code or download the executable file on GitHub.