@ -32,6 +32,13 @@ class MiceMaze(controls.KeyBindings):
for _ in range ( 5 ) :
for _ in range ( 5 ) :
self . new_rat ( )
self . new_rat ( )
def count_rats ( self ) :
count = 0
for unit in self . units . values ( ) :
if isinstance ( unit , rat . Rat ) :
count + = 1
return count
def new_rat ( self , position = None ) :
def new_rat ( self , position = None ) :
if position is None :
if position is None :
position = self . choose_start ( )
position = self . choose_start ( )
@ -69,7 +76,7 @@ class MiceMaze(controls.KeyBindings):
return True
return True
if len ( self . units ) > = 15 0:
if self . count_rats ( ) > 20 0:
self . stop_sound ( )
self . stop_sound ( )
self . play_sound ( " WEWIN.WAV " )
self . play_sound ( " WEWIN.WAV " )
self . game_end = ( True , False )
self . game_end = ( True , False )
@ -107,7 +114,7 @@ class MiceMaze(controls.KeyBindings):
unit . move ( )
unit . move ( )
unit . collisions ( )
unit . collisions ( )
unit . draw ( )
unit . draw ( )
self . engine . update_status ( f " Mice: { len ( self . units ) } - Points: { self . points } " )
self . engine . update_status ( f " Mice: { self . count_rats ( ) } - Points: { self . points } " )
self . scroll ( )
self . scroll ( )
self . engine . new_cycle ( 50 , self . update_maze )
self . engine . new_cycle ( 50 , self . update_maze )