~snakes-game/snakes-game/code

« back to all changes in this revision

Viewing changes to snakes

  • Committer: Tom Bell
  • Date: 2010-09-08 10:15:48 UTC
  • mto: This revision was merged to the branch mainline in revision 32.
  • Revision ID: bushbaby2511@gmail.com-20100908101548-lghcv7xng79rjnxk
Fixes execution regulation

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
2
import curses
3
3
from random import randint
 
4
from time import sleep
4
5
 
5
6
# Variables that may never change
6
7
UP=(-1,0)
117
118
        self.screen.move(0, 0)
118
119
 
119
120
def main(screen):
120
 
    curses.halfdelay(1)
 
121
    screen.nodelay(1)
121
122
    (screen_height, screen_width) = screen.getmaxyx()
122
123
    position = screen_height/2, screen_width/2
123
124
    snake = Snake(screen, position, LEFT)
142
143
                foods.pop(foods.index(food))
143
144
                foods.append(Food(screen,[cell.pos for cell in snake.body] \
144
145
                    +[food.pos for food in foods]))
145
 
    curses.nocbreak()
 
146
        sleep(0.05)
146
147
    quit()
147
148
 
148
149
curses.wrapper(main)