#NEWLINE# def new_position( self , snake ) : #NEWLINE# #INDENT# new_pos = snake . body [ 0 ] . pos #NEWLINE# snake_body = [ s . pos for s in snake . body ] #NEWLINE# while ( new_pos in snake_body ) : #NEWLINE# #INDENT# _x = self . rng . choice ( range ( ( self . width * 2 ) , ( self . SCREEN_WIDTH - ( self . width * 2 ) ) , self . width ) ) #NEWLINE# _y = self . rng . choice ( range ( ( self . width * 2 ) , ( self . SCREEN_HEIGHT - ( self . width * 2 ) ) , self . width ) ) #NEWLINE# new_pos = vec2d ( ( _x , new_pos ) ) #NEWLINE# #UNINDENT# self . pos = new_pos #NEWLINE# self . rect . center = ( self . pos . x , self . pos . y )