File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -800,15 +800,15 @@ def snake_embedded_keyscan():
800
800
send_command (dev , CommandVals .GameControl , [key_arg ])
801
801
802
802
803
- def game_over ():
803
+ def game_over (dev ):
804
804
global body
805
805
while True :
806
- show_string ('GAME ' )
806
+ show_string (dev , 'GAME ' )
807
807
time .sleep (0.75 )
808
- show_string ('OVER!' )
808
+ show_string (dev , 'OVER!' )
809
809
time .sleep (0.75 )
810
810
score = len (body )
811
- show_string (f'{ score :>3} P' )
811
+ show_string (dev , f'{ score :>3} P' )
812
812
time .sleep (0.75 )
813
813
814
814
@@ -850,7 +850,7 @@ def snake_embedded():
850
850
snake_embedded_keyscan ()
851
851
852
852
853
- def snake ():
853
+ def snake (dev ):
854
854
from getkey import keys
855
855
global direction
856
856
global body
@@ -892,7 +892,7 @@ def snake():
892
892
# Detect edge condition
893
893
(x , y ) = head
894
894
if head in body :
895
- return game_over ()
895
+ return game_over (dev )
896
896
elif x >= WIDTH or x < 0 or y >= HEIGHT or y < 0 :
897
897
if WRAP :
898
898
if x >= WIDTH :
@@ -905,7 +905,7 @@ def snake():
905
905
y = HEIGHT - 1
906
906
head = (x , y )
907
907
else :
908
- return game_over ()
908
+ return game_over (dev )
909
909
elif head == food :
910
910
body .insert (0 , oldhead )
911
911
while food == head :
@@ -922,7 +922,7 @@ def snake():
922
922
for bodypart in body :
923
923
(x , y ) = bodypart
924
924
matrix [x ][y ] = 1
925
- render_matrix (matrix )
925
+ render_matrix (dev , matrix )
926
926
927
927
928
928
def wpm_demo ():
@@ -944,7 +944,7 @@ def wpm_demo():
944
944
if total_time < 10 :
945
945
wpm = wpm / (total_time / 10 )
946
946
947
- show_string (' ' + str (int (wpm )))
947
+ show_string (dev , ' ' + str (int (wpm )))
948
948
949
949
950
950
def random_eq (dev ):
You can’t perform that action at this time.
0 commit comments