Skip to content

Bashmdz/pirates-of-the-python-game

Repository files navigation

Pirates of the Python

PiratesOfThePython-flowchart

"Pirates of the Python" offers a classic one-player Battleships experience against the computer. Crafting this game was enjoyable and allowed me to explore creative elements in game development.

Contents

User Experience (UX)

Initial Discussion

  • This program is a pirate-themed version of the classic Battleship game called "Pirates of the Python.".

User Goals

  • In this game, the user's goal is to strategically choose coordinates and sink the computer's battleships before the computer sinks user's ships. It's a playful twist on the classic Battleship game.

Design

Flowchart

PiratesOfThePython-flowchart

How to Play

"Pirates of the Python" follows the classic gameplay of the game "Battleship." At the main menu, the user can choose to start the game, display rules, or exit the game. Once the game begins, a set of randomly generated ships will be displayed for the user and the computer. The user will also see a blank board for reference.

During the user's turn, they will choose a row and a column. The grid will be updated to reflect hits ('!') or misses ('X'). The first to sink all the opponent's battleships wins the game. After the game, the user has the option to play again.

Live version of the game can be found here: Pirates of the Python

Features

Additionally, players can personalize their experience by choosing a pirate name. They also have the flexibility to set the grid size between 3 and 8 for added customization.

Start Screen

At the start of the game, players are greeted with the "Pirates of the Python" logo set against a pirate-themed background. Below the logo, a menu offers the following options:

  1. Display Rules
  2. Start Game
  3. Exit Game

Start-Screen1

Display Rules

Display Rules when user choose 1.

Game-Rules

Start Game

Start Game when user choose 2

Start-Game

Choosing Grid Size

Let user choose Grid size for the game, and show the board.

Grid-Size

Show-Board

Choosing Row & Column

Let user choose column & row and show results on board.

Row-Column-Choice

Draw - Attempts used

Result a draw, if user uses all attempts.

User-Win

User Wins

Result a win, if user hit all computer battleships.

User-Win

Computer Wins

Result a lose, if computer wins.

User-Win

Future Implementations

I might incorporate a scoring system for the player and potentially allow them to manually choose the positions of their battleships.

Technologies Used

Languages and Python Packages/Libraries Used

  • Python

  • Random

    • Random was used to generate the user's ships and computer ships at the beginning of the game.

Frameworks and Programs Used

    • The entire project was coded using Visual Studio Code.
    • GitHub was used to store the code online and serves as a source for Heroku.
    • Heroku was used to deploy the Python Terminal online once it was linked to the Repo.
    • Draw.io was used to create the flowchart for "Pirates of the Python."

Deployment

To deploy the final build of the project online, Heroku was used. The deployment process involved the following steps:

  1. Push the latest code to GitHub.
  2. Go to Heroku.
  3. Create a new app.
  4. Enter the application name and choose Europe for the region.
  5. Search for the Repo.
  6. Connect to the relevant repo you want to deploy.
  7. Go to the settings tab.
  8. Add buildpacks.
  9. Select Python and save changes.
  10. Select Nodejs and save changes.
  11. Ensure that Heroku/Python is at the top of the list, followed by Heroku/Nodejs.
  12. Go to the deploy tab.
  13. Scroll down to Manual Deploy and select deploy branch.

Testing

All of the code within this program was tested using Code Institute's PEP8.

PEP8-Testing

Bugs

Resolved Bugs

I addressed a bug in the user choice function where selecting the same coordinates was mistakenly counted as a new attempt. To resolve this, I implemented an error message and prevented users from choosing the same coordinates again.

Unresolved Bugs

There are no unresolved bugs.

Credits

This tutorial was instrumental in providing insights into crafting the code for the battleship game. It served as a valuable resource, offering guidance and inspiration throughout the development process.

Acknowledgements

Grateful to mentor Luke for guidance in mastering Python and game development. Thanks to Code Institute for a supportive learning environment. This experience has profoundly shaped my game creation skills.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published