summaryrefslogtreecommitdiffstats
path: root/Demo/curses/rain.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-07-18 05:56:09 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-07-18 05:56:09 (GMT)
commite6ddc8b20b493fef2e7cffb2e1351fe1d238857e (patch)
tree3b3d8fcd92e1d8f0cad44297d5c2ae8522bb984c /Demo/curses/rain.py
parent4fba4521e836e0cab08316592392b1e4d06eb6ef (diff)
downloadcpython-e6ddc8b20b493fef2e7cffb2e1351fe1d238857e.zip
cpython-e6ddc8b20b493fef2e7cffb2e1351fe1d238857e.tar.gz
cpython-e6ddc8b20b493fef2e7cffb2e1351fe1d238857e.tar.bz2
Whitespace normalization. Ran reindent.py over the entire source tree.
Diffstat (limited to 'Demo/curses/rain.py')
-rw-r--r--Demo/curses/rain.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/Demo/curses/rain.py b/Demo/curses/rain.py
index 2399d7f..69794b3 100644
--- a/Demo/curses/rain.py
+++ b/Demo/curses/rain.py
@@ -27,18 +27,18 @@ def main(win):
# Initialize it globally for convenience.
global stdscr
stdscr = win
-
+
if curses.has_colors():
bg = curses.COLOR_BLACK
curses.init_pair(1, curses.COLOR_BLUE, bg)
curses.init_pair(2, curses.COLOR_CYAN, bg)
-
+
curses.nl()
curses.noecho()
# XXX curs_set() always returns ERR
# curses.curs_set(0)
stdscr.timeout(0)
-
+
c = curses.COLS - 4
r = curses.LINES - 4
xpos = [0] * c
@@ -46,38 +46,38 @@ def main(win):
for j in range(4, -1, -1):
xpos[j] = randrange(0, c) + 2
ypos[j] = randrange(0, r) + 2
-
+
j = 0
while 1:
x = randrange(0, c) + 2
y = randrange(0, r) + 2
-
+
stdscr.addch(y, x, ord('.'))
-
+
stdscr.addch(ypos[j], xpos[j], ord('o'))
-
+
j = next_j(j)
stdscr.addch(ypos[j], xpos[j], ord('O'))
-
+
j = next_j(j)
stdscr.addch( ypos[j] - 1, xpos[j], ord('-'))
stdscr.addstr(ypos[j], xpos[j] - 1, "|.|")
stdscr.addch( ypos[j] + 1, xpos[j], ord('-'))
-
+
j = next_j(j)
stdscr.addch( ypos[j] - 2, xpos[j], ord('-'))
stdscr.addstr(ypos[j] - 1, xpos[j] - 1, "/ \\")
stdscr.addstr(ypos[j], xpos[j] - 2, "| O |")
stdscr.addstr(ypos[j] + 1, xpos[j] - 1, "\\ /")
stdscr.addch( ypos[j] + 2, xpos[j], ord('-'))
-
+
j = next_j(j)
stdscr.addch( ypos[j] - 2, xpos[j], ord(' '))
stdscr.addstr(ypos[j] - 1, xpos[j] - 1, " ")
stdscr.addstr(ypos[j], xpos[j] - 2, " ")
stdscr.addstr(ypos[j] + 1, xpos[j] - 1, " ")
stdscr.addch( ypos[j] + 2, xpos[j], ord(' '))
-
+
xpos[j] = x
ypos[j] = y
@@ -90,5 +90,5 @@ def main(win):
stdscr.nodelay(1)
curses.napms(50)
-
+
curses.wrapper(main)