Inspiration

One of the sessions this Global Hack Week covered many Python basics including how to code a rock, paper, scissors game. While coding along, there were many times I thought about how I would code it differently, so I decided to participate in the "Build a Rock, Paper, Scissors Game" Challenge!

What it does

This project simulates a rock, paper, scissors game in the console, where the user can play any number of times against the computer or quit the game.

How we built it

This project was developed in Python in a single file, consisting of multiple function declarations and a single call to the main function. The main function runs through the game, calling the other functions to print to the console, handle inputs, or quit the game. The user can enter a choice among "rock", "paper", "scissors", or even "quit", and assuming they didn't quit, they play against the computer and a winner is presented. Python's built-in module "random" was used to generate a random number and a Python dictionary was used to translate the random number into a response for the computer.

Challenges we ran into

Most of the challenges that came up were actually external: the laptop used for development ran into some hardware issues and the lack of familiarity with Devpost led to losing the text for this very page a few times. However, due to facing these challenges during this Global Hack Week, now particular hardware issues are easy to spot and future mishaps with Devpost may be avoided.

Accomplishments that we're proud of

The input validation function was constructed such that given any variable and a collection of valid values, the function will continue prompting the user to enter a value that matches one of the valid values. This function could thus be used for both user inputs where the user makes a choice of "rock", "paper", "scissors", or "quit" during the game and where the user makes a choice of "y" or "n" to start a new game or quit.

What we learned

One of the surprisingly simple yet important things learned was how to separate a long line of Python code into multiple lines. This made the code, neat, more readable, and more easy to understand.

What's next for Rock, Paper, Scissors Game

In the future the Rock, Paper, Scissors Game will have an improved UI to take the user out of the console and into the browser. This will significantly improve the user's experience with the game.

Built With

Share this project:

Updates