Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

readme.md

21 Number Game

This is a simple 21 number game using Python programming language. The game illustrated here is between the player and the computer. There can be many variations in the game.

Rule of the game :-

1 The player can choose his/her preferences that whether he/she can play first or second.
2 There will be always showing list of numbers before the player takes his turn.
3 if player chooses first chance then he/she can only input the numbers between 0 and 4.
4 if player chooses second chance then he/she can input the numbers but it is prefer to input the numbers between 0 and 4.
5 Most important rule :- player will only input the values in consecutive numbers like (2,3,4,5...)
6 If consecutive numbers are not given in input then the player is automatically disqualified.
7 The player loses if he gets the chance to call 21 and wins otherwise.

Secret to win the game:-

if player choose second chance then he/she can win.

How to run

1. Fork this repository. Click on the symbol at the top right corner.

2. Clone the forked repository.

git clone https://github.com/<your-github-username>/Hacking-Scripts

3. Navigate to the project directory.

cd Hacking-Scripts/python/21 Number Game
python 21_number_game.py

I am attaching workflow of the code using snapshots.

Screenshots

  1. First the welcome screen comes and say choose you want to play the game or not.

2. if you input yes and after it will show the order of inputs after the computer's turn because you choose S (second chance) and say how many inputs you want to give.

3. Now i take input 3 values and give the values in consecutive manner and then it will show order of inputs after the computer's turn and agin ask for no. of values.

4. Now i take 1 input value and give the values in consecutive manner and then it will show order of inputs after the computer's turn and agin ask for no. of values.

5. Now i take 1 input value and give the values in consecutive manner and then it will show order of inputs after the computer's turn and agin ask for no. of values.

6. Now i take 1 input value and give the values in consecutive manner and then it will show order of inputs after the computer's turn and agin ask for no. of values.

7. Now final turn! i take 1 input value and give the values in consecutive manner and then it will show Hurray! you won the game shows in above snapshot that means you won.


Contributor
Rahul Srivastava