Nour-Sadek/Generating-Randomness
This program prompts the user to play a game where, after "studying" the user's patterns in randomly typing 0's and 1's, aims to predict the user's input later
Generating Randomness
Prompts the user to play a game where, after "studying" the user's patterns in
randomly typing 0's and 1's, aims to predict the user's input later, starting
with a balance of $1000 and the user losing $1 if the program predicts the
output correctly but gaining $1 if it predicts incorrectly.
General Info
To learn more about this project, please visit HyperSkill Website - Generating Randomness Project.
This project's difficulty has been labelled as Medium where this is how
HyperSkill describes each of its four available difficulty levels:
- Easy Projects - if you're just starting
- Medium Projects - to build upon the basics
- Hard Projects - to practice all the basic concepts and learn new ones
- Challenging Projects - to perfect your knowledge with challenging tasks
This Repository contains two .py files:
code.py - Contains the code for the first three stages of the project which set the stage for the implementation of the game
Generating-Randomness-Game.py - Contains the program in which the game should be run
Project was built using python version 3.11.3
How to Run
Download the files to your local repository and open the project in your choice
IDE and run the project.
-
You will be prompted to print a random string containing 0 or 1, and will keep being prompted until
the minimum number of symbols (originally set to 100 but the constant MIN_LEN
can be changed) have been received. It will be able to handle symbols other
than 0 or 1. -
After that, the final string as well as your allowance of $1000 (can
also be changed, saved under ALLOWANCE constant) will be displayed. -
You will be prompted to print a random string containing 0 or 1, and will be
prompted again if the total number of 0's and 1's doesn't exceed 4. -
After that, the program's prediction as well as your current, updated
balance will be displayed. -
Steps 3 and 4 will keep repeating until you type enough, after which the
program's execution ends.