Last active
August 8, 2020 02:44
-
-
Save KaiserWilhelm23/2ce6a533e20dfa9005cb27b7ab7481f4 to your computer and use it in GitHub Desktop.
The code for guessing game. You must have Pythonista to run this code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import sys | |
import time | |
import os | |
import console | |
from datetime import datetime | |
def Controls(): | |
print('Welcome to the guessing game version 0.9.4') | |
print('--'*10) | |
c2 = print('Press Enter to Start\n') | |
input() | |
global un | |
un = input('please enter a username') | |
time.sleep(0.4) | |
print('--'*10) | |
print('HELLO: ', un) | |
print('--'*10) | |
Controls() | |
def difficulty(): | |
print('Difficuty:') | |
print('Press e for easy. Press h for Hard. ' ) | |
c3 = input('Easy, Hard: \n') | |
difficulty = 0 | |
e = 5 | |
h = 10 | |
global points | |
points = 0 | |
if c3.lower() == 'e' : | |
difficulty = e | |
print('Setting to easy') | |
time.sleep(0.3) | |
clr = console.clear() | |
format(clr) | |
print('--'*10) | |
print('loading........') | |
print('--'*10) | |
start_time = datetime.now() | |
time.sleep(0.4) | |
elif c3.lower() == 'h': | |
difficulty = h | |
print('Setting to hard') | |
time.sleep(0.4) | |
clr = console.clear() | |
format(clr) | |
print('--'*10) | |
print('loading........') | |
print('--'*10) | |
start_time = datetime.now() | |
time.sleep(0.8) | |
def restart(): | |
choice = input("Want to play again y/n\n") | |
if choice.lower() == "y": | |
clr = console.clear() | |
format(clr) | |
time.sleep(0.1) | |
game() | |
elif choice.lower() =="n": | |
clr = console.clear() | |
format(clr) | |
time.sleep(0.1) | |
print('GOOD BYE, PLAY AGAIN SOON!!') | |
print('--'*10) | |
end_time = datetime.now() | |
print('Time of game play: {}'.format(end_time - start_time)) | |
print('--'*10) | |
print('You Finished with ',points, ' points!!') | |
sys.exit() | |
def game(): | |
clr2 = console.clear() | |
format(clr2) | |
print('username: ', un) | |
global points | |
print("The computer can only guess 1-{0}".format(str(difficulty))) | |
time.sleep(0.05) | |
print('please pick a number') | |
num = int(input()) | |
print("your number:",num) | |
print('--'*10) | |
g = random.randint(1,difficulty) | |
print("computers number: ",g) | |
print('--'*10) | |
print("Try this number next! ",random.randint(1,difficulty)) | |
print('--'*10) | |
if num == g: | |
print("Good job you won!! :)") | |
print('☑️') | |
print('--'*10) | |
points = points + 1 | |
print('Points: ', points) | |
else: | |
print("You lose :(") | |
print('❗') | |
print('--'*10) | |
print('You earned no points.', ' your current points: ', points) | |
print('--'*10) | |
restart() | |
game() | |
difficulty() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Guessing game BETA 2020 | |
import random | |
import sys | |
def restart(): | |
choice = input("Want to play again y/n\n") | |
if choice.lower() == "y": | |
game() | |
elif choice.lower() =="n": | |
sys.exit() | |
def game(): | |
print("The computer can only guess 1-2000") | |
print('please pick a number') | |
num = input() | |
print("your number:",num) | |
print("____________________") | |
print("computers number: ",random.randint(1,2000)) | |
print("____________________") | |
print("Try this number next!",random.randint(1,2000)) | |
print("_______________________________________________") | |
print('Powerd by python 3.6') | |
print('Version BETA') | |
restart() | |
game() | |
#copyright 2020 Will Payne all rights reserved. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RELEASE NOTES | |
release Beta: Computer able to guess numbers 1-10. (not released to the public) | |
Giving the player a number to try to next. | |
play again function. | |
release 0.1.0: Difficulty update introducing Easy and Hard difficuties | |
computer guesses 1-10 on easy | |
computer guesses 1-20 on hard | |
release 0.2.1 try this update! | |
you will now get output called try this number. All this does is give you a suggestion! | |
ex. Try this number next! 10 | |
release 0.3.2 the sound update! | |
We added some sound to this game | |
We now have loading screens. | |
bug fixes in the sound. | |
release 0.4.2 Update | |
Not much has been added | |
We added a you lose message when you guess the wrong number and a you win message when you guess the right number! | |
the difficulties have been reduced | |
So on easy: Guess the correct number 1-5 | |
hard: Guess The correct number 1-10 | |
release 0.5.2 | |
Still not much has been added | |
new sounds for when you guess the wrong number and the right number | |
new figures have been added as well | |
ex. | |
you lose :( | |
❗ | |
or | |
you win :)!! | |
☑ | |
release 0.6.2 | |
We have added a user name function to the game! | |
ex. | |
type in your username: | |
user input | |
disclaimer: We do not keep any of these usernames that are inputed into the computer. We are planing to never bring | |
guessing game to world wide web. | |
release 0.7.3 | |
We have added a new addition to the game. | |
After every round the console out will clear when you tell the game that you want to play agian or not. | |
This is to help prevent crashes of python ide's | |
also now with reduced loading speeds | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment