-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2048.py
More file actions
46 lines (40 loc) · 1.12 KB
/
Copy path2048.py
File metadata and controls
46 lines (40 loc) · 1.12 KB
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
import logic
if __name__=='__main__':
mat = logic.start()
while(True):
x= input("Press the command: ")
if(x == "W" or x == "w"):
mat, flag = logic.move_up(mat)
status = logic.get_current_state(mat)
print(status)
if(status == "Game continues"):
logic.add_2(mat)
else:
break
elif(x == "A" or x == "a"):
mat, flag = logic.move_left(mat)
status = logic.get_current_state(mat)
print(status)
if(status == "Game continues"):
logic.add_2(mat)
else:
break
elif(x == "D" or x == "d"):
mat, flag = logic.move_right(mat)
status = logic.get_current_state(mat)
print(status)
if(status == "Game continues"):
logic.add_2(mat)
else:
break
elif(x == "S" or x == "s"):
mat, flag = logic.move_down(mat)
status = logic.get_current_state(mat)
print(status)
if(status == "Game continues"):
logic.add_2(mat)
else:
break
else:
print("Invalid Key")
print(mat)