-
Notifications
You must be signed in to change notification settings - Fork 206
/
main.py
52 lines (44 loc) · 1.7 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import turtle
import pandas
screen = turtle.Screen()
screen.title("Guess The Indian State")
screen.setup(width = 650, height = 700)
screen.addshape("PyVerse/Game_Development/Map Game/Indian_Map.gif")
turtle.shape("PyVerse/Game_Development/Map Game/Indian_Map.gif")
location = pandas.read_csv("PyVerse/Game_Development/Map Game/Indian_states.csv")
all_states = location["State"].to_list()
def map_game():
guess = screen.textinput("Guess The State","Enter The Name of the Next State ?")
if guess:
guess = guess.title()
score = 0
flag = True
while flag:
if guess in all_states:
state_name = turtle.Turtle()
state_name.hideturtle()
state_name.penup()
new_location = location[location.State == guess]
score += 1
state_name.goto(x = new_location["Latitude"].item(), y = new_location["Longitude"].item())
state_name.write(new_location["State"].item())
all_states.remove(guess)
elif guess == "Exit":
print (all_states)
print (len(all_states))
flag = False
guess = screen.textinput(f"{score}/29 Guessed Correctly","Enter The Name of the Next State ?")
if guess:
guess = guess.title()
continue
else:
print(f"Quiting The Game with Score {score}/29....")
flag = False
turtle.bye()
if score > 28:
flag = False
turtle.done()
else:
print("Quiting The Game....")
if __name__ == "__main__":
map_game()