forked from tangentcode/learntris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
learntris.py
39 lines (35 loc) · 1.06 KB
/
learntris.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
from src.board import *
def main():
""" Main function """
board = Board()
while True:
for code in input().split(" "):
if code == "q":
exit()
elif str.lower(code) == "p":
board.print_board()
elif code == "g":
inp = []
for a in range(22):
inp.append(input())
board.set_board(inp)
elif code == "c":
board.clear()
elif code == "?s":
print(board.get_score())
elif code == "?n":
print(board.get_cleared_lines())
elif code == "s":
board.run_one_step()
elif str.isupper(code):
board.set_tetramino(code)
elif code == "t":
board.print_tetramino()
elif code == ")":
board.rotate_current()
elif code == ";":
print("")
else:
print("Wrong code!")
if __name__ == '__main__':
main()