File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 2
2
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
3
3
# Original Author : Sanchit Gangwar
4
4
# Modified by : Rayan Dutta
5
+ # Minor changes made to keep the game working.
5
6
6
7
import curses
7
8
from curses import KEY_RIGHT , KEY_LEFT , KEY_UP , KEY_DOWN
28
29
win .border (0 )
29
30
win .addstr (0 , 2 , 'Score : ' + str (score ) + ' ' ) # Printing 'Score' and
30
31
win .addstr (0 , 27 , ' SNAKE ' ) # 'SNAKE' strings
31
- win .timeout (150 - (len (snake )/ 5 + len (snake )/ 10 )% 120 ) # Increases the speed of Snake as its length increases
32
+ win .timeout (int ( 150 - (len (snake )/ 5 + len (snake )/ 10 )% 120 ) ) # Increases the speed of Snake as its length increases
32
33
33
34
prevKey = key # Previous key pressed
34
35
event = win .getch ()
59
60
#if snake[0][0] == 0 or snake[0][0] == 19 or snake[0][1] == 0 or snake[0][1] == 59: break
60
61
61
62
# If snake runs over itself
62
- if snake [0 ] in snake [1 :]: break
63
-
63
+ if snake [0 ] in snake [1 :]:
64
+ print ('Game Over' )
65
+ break ;
64
66
65
67
if snake [0 ] == food : # When snake eats the food
66
68
food = []
You can’t perform that action at this time.
0 commit comments