Skip to content

0NETRUNNER/terminal-dice-pp3

Repository files navigation

Terminal Dice

Play the game here

Terminal Dice is a game of chance that mimics the popular casino game called Craps or Casino Dice. It runs in the Code Institute mock terminal on Heroku. The game involves rolling a pair of dice, and depending on the outcome, the player either wins or loses. The player must win the game on their first attempt, or they need to roll their point twice in a row to win. The game continues until the player decides to stop playing. Am I responsive

GitHub last commit GitHub contributors GitHub language count GitHub top language GitHub Commit activity Code size Github files

Github stars Github forks

Contents

How to play

  1. The player rolls the dice and the computer adds the numbers together.
  2. If the total is 7 or 11 the player wins.
  3. If the total is 2, 3, or 12, the player loses.
  4. If the total is any other number 4, 5, 6, 8, 9, or 10 that number becomes the point.
  5. The player then continues to roll the dice until they either roll the point again and win or they roll a 2, 3, 7, 11 or 12 and lose.

FlowChart

Features

Colour Scheme

I wanted to add some colour but with this project being in the terminal I thought I couldnt or I would be limited and then I discovered Colorama.

I watched this video to see how to add Colorama to the project.

  • Red - Is used for the border of the welcome message and the border of the exit message. I also used Red in all error messages and anything that is considered negative.
  • Green - Is used for anything considered postive and for game commands as in loading game, meeting age requirments etc.
  • Blue - Is used for the welcome message and the end game message.
  • Yellow - Is used for anything to do with the Dice. Dice rolling, telling you your score and the intructions.
  • Cyan - Is used for asking questions as in your name, age, do you want to play etc.

Exisiting Features

  • When the game starts you get a welcome message which leads into asking you your name.

  • Starting the game

  • After entering your name you will be asked your age you can only play if you are over 21.

  • What age are you

  • If you are not old enough to play to game will exit and restart.

  • exiting game

  • After giving your age if you are old enough to play you will be asked if you know how to play.

  • Do you know how to play

  • If you clicked 'n' it will take you to the instructions then it will ask you if you want to play.

  • Intructions

  • Intructions

  • After starting the game it will ask you to enter 'r' to roll your dice.

  • Star the game

  • When you enter 'r' the dice will print to the terminal and add the two dice together to give you your total.

  • Show the Dice

  • If you dont win or lose on your first roll the game will continue to the point and continue until you hit your point again or lose.

  • The point

  • The point win

  • Everytime you win or lose the game will ask if you want to play again.

  • If you choose to exit the game it will bring you back to the welcome screen.

  • Exit game

Future Features

  • It would be great to provide users with the ability to create their own accounts and save their names and scores. This feature can personalize the gaming experience, as players can keep track of their progress and compete against other players' high scores. Additionally, having a user account system can encourage players to return to the game and improve their scores over time.

  • Game variations by adding different variations of craps, such as Simplified Craps or High Point Craps, players can experience different rule sets and strategies, which can keep the game fresh and engaging over multiple play sessions.

  • I think it would be a good idea to include a betting system in the game, so players can decide how much money to bet on each roll. This will add more excitement to the game and make it more replayable, as players can try different betting strategies to see which one works best.

  • I could integrate more advanced statistics and metrics into the game, such as the average number of rolls per game or the most common point values rolled, to give players deeper insights into their gameplay and allow them to make more informed decisions.

  • Along with the betting system I would like to implement a cash out system if the player is feeling unlucky.

Testing

Validation

I used the Code Institute Pep8 Linter for testing no errors were found.

  • run.py
    • Run.py
  • dice_art.py
    • dice_art.py

Manual Testing

Feature Expected Outcome Testing Performed Result Pass/Fail
What is your name? Logs name Empty space, letters & numbers It logs any input its given. Pass
What is your age? Accepts age or exits game if under 21 Empty space, letters & numbers It logs any age over 21, ends game for under 21 & gives a error invalid input. Please enter a valid age Pass
Do you know how to play? Takes you to the game or the instructions. Empty space, letters & numbers It only accpets 'y' or 'n' as an answer otherwise it prints "Please enter 'y' or 'n' try again" & repeats the question Pass
Do you want to start the game? Starts the game or exits the game. Empty space , letters & numbers Any input that is not 'Y' or 'n' prints a error "Please enter 'y' or 'n'" & repeats the question Pass
Please use 'r' to roll your dice Prints the dice at random & adds the score together. Empty space, letters & numbers Any input that is not 'r' prints a error "You have to enter 'r' to roll your dice try again" & repeats the question. Pass
Do you want to play again? 'y' or 'n' Brings you back to roll the dice again or exits the game Empty space, letters & numbers Any input that is not 'Y' or 'n' prints a error "Please enter 'y' or 'n' try again" & repeats the question Pass

Bugs

Bug Solution
The game logic kept printing the same dice over and over again I had the varible in global scope and I never passed my function a argument.
The game logic was not accepting a 7 as a lose condition after the first roll I had to restructure the elif/else statements and put them in order of importance.
The game would not deploy to Heroku I changed the name of my run.py file at the start so I had to change it back to solve this issue.
When I entered a value that wasnt a number I got a traceback error I used a try/except to repeat the code if the input is not a number.

Remaining bugs

  • No bugs remain.

Deployment

Heroku

This project was deployed using Code Institutes mock terminal for Heroku.

  • Steps for deployment.
  • Fork or clone this repository.
  • Create a new Heroku app.
  • Set the build packs to Python and Nodejs in that order.
  • Link the Heroku app to the repository.
  • Click on Deploy.

Local Deployment

How to Fork

To fork the repository:

  1. Log in to Github.
  2. Go to the repository for this project, DylanP400/terminal-dice-pp3
  3. Click the Fork button in the top right corner.

How to clone

To clone the repository:

  1. Log in to GitHub.
  2. Go to the repository for this project, DylanP400/terminal-dice-pp3
  3. Click on the code button, select whether you would like to clone with HTTPS, SSH or GitHub CLI and copy the link shown.
  4. Open the terminal in your code editor and change the current working directory to the location you want to use for the cloned directory.
  5. Type 'git clone' into the terminal and then paste the link you copied in step 3. Press enter.

Credits

Code Used

  • For printing out the dice to the terminal I used a line of code from Bro Code's video I also used the design for the dice in the dice_art.py
  • I used fsymbols for the ACSSI art in the introduction.

Acknowledgments

  • I would like to thank my mentor Rory for all the help and guidance through out the Project.
  • I would like to thank the Tutor support system for helping me when I was stuck or unsure.
  • Code Instittute for the deployment terminal.
  • Tech with Tim for making a guide on using Colorama.

About

A game of dice played in the terminal made with Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published