-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsandbox.py
45 lines (41 loc) · 1.4 KB
/
sandbox.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
import curses
from curses import wrapper
MAP = """###################################X#
# # # # # # #
# # ##### # ### ##### ### ### ### # #
# # # # # # # # # #
##### # ##### ##### ### # # # ##### #
# # # # # # # # # # #
# # ####### # # ##### ### # ##### # #
# # # # # # # # # #
# ####### ### ### # ### ##### # ### #
# # # # # # # # # #
# ### ### # ### # ##### # # # ##### #
# # # # # # # # # # # #
####### # # # ##### # ### # ### ### #
# # # # # # # # # #
# ### # ##### ### # ### ### ####### #
# # # # # # # # # #
# # ##### # ### ##### # # ####### # #
# # # # # # # # # # #
# ##### # # # ### ##### ##### # #####
# # # # # # # # # #
# # ### ### ### ##### ### # ##### # #
# # # # # # #
#X###################################"""
inpits = {curses.KEY_UP: "Up",
curses.KEY_DOWN: "Down"}
def main(stdscr):
stdscr.clear()
while True:
# Store the key value in the variable `c`
c = stdscr.getch()
# Clear the terminal
stdscr.clear()
if c in inpits:
stdscr.addstr(inpits[c])
else:
stdscr.addstr("Nope")
# wrapper is a function that does all of the setup and teardown, and makes sure
# your program cleans up properly if it errors!
wrapper(main)