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 22# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
33# Original Author : Sanchit Gangwar
44# Modified by : Rayan Dutta
5+ # Minor changes made to keep the game working.
56
67import curses
78from curses import KEY_RIGHT , KEY_LEFT , KEY_UP , KEY_DOWN
2829 win .border (0 )
2930 win .addstr (0 , 2 , 'Score : ' + str (score ) + ' ' ) # Printing 'Score' and
3031 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
3233
3334 prevKey = key # Previous key pressed
3435 event = win .getch ()
5960 #if snake[0][0] == 0 or snake[0][0] == 19 or snake[0][1] == 0 or snake[0][1] == 59: break
6061
6162 # 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 ;
6466
6567 if snake [0 ] == food : # When snake eats the food
6668 food = []
You can’t perform that action at this time.
0 commit comments