snake
view main.py @ 174:55aeb245c503
fixed bug of lost previous snakes memory,
while turning from run mode to step and back
fixes #19
author | Alex Martynov |
---|---|
date | Fri, 24 Dec 2010 00:58:36 +0300 |
parents | 008be193a0a3 |
children | fde515c7a4c8 |
line source
9 """User Interface:
11 Atributes:
13 - 'root' - root Window game placed at
14 - 'engine' - engine of the game
15 - 'canvas' - Widget field is pictured at
16 - 'step_id' - current step of the game
17 - 'after_id' - identificator of runing game process
18 - 'step_legth' - length of the step (in ms)
19 - 'game_length' - number of the steps in one round of the game"""
21 """Create Python Battle game window.
22 Initialyze engige of the game."""
33 return
36 """Packing the buttons in root frame.
37 Definition of button functions.
39 'Load' - ask for snake file load
40 'Run' - runs the game/next round. Next round starts with snakes survived in previous
41 'Step' - do the next dtep of the game
42 'End' - manual end of the game
43 'Restart" - restart the field with snakes of previous round"""
66 """Ask for snake file loading.
67 Initialyzing snake and draw it on the field.
68 Return field back to default (without snakes) after end of the game."""
72 pass
76 return
79 pass
82 return
85 """Init running of the game."""
93 """Run the game with 'step_length' ms step
94 After the end of the game - restarts it with snakes survived in
95 previous game"""
98 return
100 return
104 return
107 """Do the next game step"""
109 return
115 pass
118 pass
121 pass
122 return
125 """Check the number of snakes alive.
126 End the game if alive snake number is less than two."""
131 pass
137 """"Restarts snakes positions after the end of the game
139 Options:
140 survived = "yes" - restarts next round only with snakes survived in previous round
141 survived = "no" - restart next roun with all snakes played in previous round"""
155 """End the game and raise the window that tels about it."""
158 pass
164 pass