snake
view snake.py @ 96:3619305694ad
Actually fixed buttons resizing. Fixed code separation for buttons drawing.
author | Danya Alexeyevsky <me.dendik@gmail.com> |
---|---|
date | Mon, 20 Dec 2010 02:26:35 +0300 |
parents | 2f56e186e75c |
children | c68b54a43501 |
line source
1 """Guts of snakes."""
6 """Remove comments and junk spaces from line of snake definition file."""
13 """Snakes.
15 Attributes:
17 - `cells` -- list of cells belonging to the snake The first of these cells
18 becomes head, the last one becomes tail, the rest ar body. If snake has
19 only one cell, it is tail.
20 - `color` -- color of snake
21 - `rules` -- a list of Rule objects
22 """
30 """Load snake description from file.
32 See program design docs for file syntax.
33 """
36 break
41 break
46 """Mark every cell in `self.cells` as belonging to self."""
53 return
56 """Rule defining possible behaviour of snake."""
65 }
73 """Load rule definition from file.
75 Ignore any leading empty lines.
76 Return self.
77 """
82 continue
89 break
93 """Parse definition of cell in rule file.
95 Cell is defined by one character.
96 """
114 """True if the rule applies in the field at position (x,y)."""
126 """Rotate rule pattern `rot` times counterclockwise."""
131 """Rotate rule pattern one time counterclockwise."""
140 # vim: set ts=4 sts=4 sw=4 et: