snake
changeset 41:bcad0f5464bf
snake.Rule.load: give reasonable error rather than crash on empty lines
author | Daniil Alexeyevsky <me.dendik@gmail.com> |
---|---|
date | Sun, 19 Dec 2010 22:49:53 +0300 |
parents | 94945f11c78d |
children | 21a5779088e6 |
files | snake.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line diff
1.1 --- a/snake.py Sun Dec 19 22:46:39 2010 +0300 1.2 +++ b/snake.py Sun Dec 19 22:49:53 2010 +0300 1.3 @@ -54,8 +54,8 @@ 1.4 continue 1.5 if y == 7: 1.6 break 1.7 + assert len(line) == 8, "Rule lines must be exactly 7 chars long" 1.8 assert line[-1] == ';', "Rule lines must end with semicolon" 1.9 - assert len(line) == 8, "Rule lines must be exactly 7 chars long" 1.10 for x, char in enumerate(line[:8]): 1.11 self.parse_cell(x, y, char) 1.12 y += 1