-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
54 lines (35 loc) · 1.57 KB
/
app.py
File metadata and controls
54 lines (35 loc) · 1.57 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
47
48
49
50
51
52
53
54
from curses import wrapper
from tetris.engine import Engine
from tetris.board import Board
from tetris.display import Display
from tetris.config import SPEED, DEBUG, TICK_LENGTH, HEIGHT, WIDTH
# FIXME 1: The game_window scrolls up by one line or fails when height is not
# + 1 greater than area being written to, also forces border window to be
# 1 unit longer in y; not initially a problem and unknown cause
# TODO 1: Spawn pieces above play area
# * 2-4 invisible rows (vanish zone) https://harddrop.com/wiki/Playfield
# * allows other types of losses
# TODO 2: Wall-kicking
# TODO 3: Soft dropping and hard dropping
# TODO 4: Find what the default background color is when wrapper inits
# and how that interacts with the curses.use_default_colors() call, for proper
# cross-platform, cross-terminal display
# TODO 5: Better debugging
# * separate debugger/logger that has access to windows and handles curses directly
# TODO 6: Document
# TODO 7: Make force dropping increase score
# TODO 8: Add counter-clockwise rotation
# TODO 9: Add generic rotation algorithm
# TODO 10: Simplify tetromino_attributes and symbol_to_color
# Curses references:
# https://docs.python.org/3.6/library/curses.html
# https://docs.python.org/3/howto/curses.html
# TODO: Ideally debug is passed into engine
# TODO: Remove display from being passed to board
def main(screen):
display = Display(screen, HEIGHT, WIDTH, debug=DEBUG)
board = Board(display, HEIGHT, WIDTH, debug=DEBUG)
game = Engine(board, display, SPEED, TICK_LENGTH)
game.run()
if __name__ == "__main__":
wrapper(main)