AI simulation for guessing the number (#219)

* Add files via upload

* Create README.md

* Create Requirements

* Update README.md
This commit is contained in:
ShadowHunter15 2021-10-02 14:02:21 +03:00 committed by GitHub
parent 5df866d1d2
commit 968bb023f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 130 additions and 0 deletions

View File

@ -0,0 +1,127 @@
import random
print("wassup hommie, care to play a game?")
print("i'll try to guess the number YOU choose.")
print("please tell me the borders: ")
a = int(input("Min: "))
b = int(input("Max: "))
while True:
if(a > b):
(print("error, min can't be more than max. "))
a = int(input("Min: "))
b = int(input("Max: "))
else:
break;
breaking = "------------"
print("now type in the number: ")
c = int(input(" "))
tries = 1;
d = random.randint(a, b)
while True:
if(d == c and tries == 1):
print("guess 1: " + str(d))
print("HA, gotcha. I got it in 1 time!")
print("Wanna go again? y for yes and anykey for no. ")
i = input("");
if(i == "y"):
print(breaking * 10);
a = int(input("Min: "))
b = int(input("Max: "))
print("now type in the number")
c = int(input(" "))
tries = 1;
if(a > b):
print("error, min can't be more than max. ")
a = int(input("Min: "))
b = int(input("Max: "))
print("now type in the number")
c = int(input(" "))
else:
d = random.randint(a, b)
else:
break;
elif(d == c):
print("HA, gotcha. I got it in " + str(tries - 1) + " times!")
print("Wanna go again? y for yes and anykey for no. ")
i = input("");
if(i == "y"):
print(breaking * 10);
a = int(input("Min: "))
b = int(input("Max: "))
print("now type in the number")
c = int(input(" "))
tries = 1;
if(a > b):
print("error, min can't be more than max. ")
a = int(input("Min: "))
b = int(input("Max: "))
print("now type in the number")
c = int(input(" "))
else:
d = random.randint(a, b)
else:
break;
elif(c > b):
print("error, number can't be bigger than max.");
print("Wanna go again? y for yes and anykey for no. ")
i = input("");
if(i == "y"):
print(breaking * 10);
a = int(input("Min: "))
b = int(input("Max: "))
print("now type in the number")
c = int(input(" "))
tries = 1;
if(a > b):
(print("error, min can't be more than max. "))
a = int(input("Min: "))
b = int(input("Max: "))
print("now type in the number")
c = int(input(" "))
else:
d = random.randint(a, b)
else:
break;
elif(c < a):
print("error, number can't be smaller than min.");
print("Wanna go again? y for yes and anykey for no. ")
i = input("");
if(i == "y"):
print(breaking * 10);
a = int(input("Min: "))
b = int(input("Max: "))
print("now type in the number")
c = int(input(" "))
tries = 1;
if(a > b):
print("error, min can't be more than max. ")
a = int(input("Min: "))
b = int(input("Max: "))
print("now type in the number")
c = int(input(" "))
else:
d = random.randint(a, b)
else:
break;
elif(d < c):
a = d + 1;
d = random.randint(a, b)
print( "guess " + str(tries) + " :" + str(d));
tries += 1;
elif(d > c):
b = d - 1;
d = random.randint(a, b)
print( "guess " + str(tries) + " :" + str(d))
tries += 1
input=""

View File

@ -0,0 +1 @@
This is a simulation of a computer trying to guess a number, it works with any number of zeroes, furthest i got was 13000 zeroes, so have fun . :)

View File

@ -0,0 +1 @@
no requirements, just have python installed. :)

View File

@ -11,6 +11,7 @@ So far, the following projects have been integrated to this repo:
| Project Name | Contributors |
|--|--|
| [AI for guess the number](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/AI_for_Guess_the_number) | [Omar Sameh](https://github.com/ShadowHunter15) |
| [sudoku-solver](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/sudoku-solver) | [Rishabh Umrao](https://github.com/ayedaemon) |
|[File Encrypt Decrypt](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/file-encrypt-decrypt)|[Aditya Arakeri](https://github.com/adityaarakeri)|
| [Address locator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Location_Of_Adress) | [Chris]() |