File tree 1 file changed +4
-4
lines changed 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 17
17
# Make board updates faster
18
18
#
19
19
20
+ import random , string , traceback
21
+ import curses
22
+
20
23
class LifeBoard :
21
24
"""Encapsulates a Life board
22
25
@@ -118,11 +121,10 @@ def display(self, update_board=1):
118
121
119
122
def makeRandom (self ):
120
123
"Fill the board with a random pattern"
121
- import whrandom
122
124
self .state = {}
123
125
for i in range (0 , self .X ):
124
126
for j in range (0 , self .Y ):
125
- if whrandom .random ()* 10 > 5.0 : self .set (j ,i )
127
+ if random .random () > 0.5 : self .set (j ,i )
126
128
127
129
128
130
def erase_menu (stdscr , menu_y ):
@@ -139,7 +141,6 @@ def display_menu(stdscr, menu_y):
139
141
'E)rase the board, R)andom fill, S)tep once or C)ontinuously, Q)uit' )
140
142
141
143
def main (stdscr ):
142
- import string , curses
143
144
144
145
# Clear the screen and display the menu of keys
145
146
stdscr .clear ()
@@ -196,7 +197,6 @@ def main(stdscr):
196
197
else : pass # Ignore incorrect keys
197
198
198
199
if __name__ == '__main__' :
199
- import curses , traceback
200
200
try :
201
201
# Initialize curses
202
202
stdscr = curses .initscr ()
You can’t perform that action at this time.
0 commit comments