snake
diff snake.py @ 74:66a80dc7306d
Automated merge with ssh://kodomo/snake
author | Danya Alexeyevsky <me.dendik@gmail.com> |
---|---|
date | Mon, 20 Dec 2010 00:46:59 +0300 |
parents | e8eabd9530a1 |
children | 2756d863bffb |
line diff
1.1 --- a/snake.py Mon Dec 20 00:45:40 2010 +0300 1.2 +++ b/snake.py Mon Dec 20 00:46:59 2010 +0300 1.3 @@ -94,10 +94,12 @@ 1.4 1.5 Cell is defined by one character. 1.6 """ 1.7 - assert char.lower() in self.codes, "Illegal symbol in rule: %s" % char 1.8 + is_my = char.islower() 1.9 + char = char.lower() 1.10 + assert char in self.codes, "Illegal symbol in rule: %s" % char 1.11 cell = engine.Cell(x, y, self.snake) 1.12 if char in 'htb': 1.13 - if char.islower(): 1.14 + if is_my: 1.15 cell.snake_type = 'my' 1.16 else: 1.17 cell.snake_type = 'enemy' 1.18 @@ -105,7 +107,7 @@ 1.19 assert (x, y) == (3, 3), "Own head must in the center of rule" 1.20 if (x, y) == (3, 3): 1.21 assert char == 'h', "In the center of rule must be own head" 1.22 - cell.type = self.codes[char.lower()] 1.23 + cell.type = self.codes[char] 1.24 self.pattern[x, y] = cell 1.25 1.26 def applies (self, field, x, y):