<s> '''<STR_LIT>''' <EOL> import random <EOL> class RandomWalker ( object ) : <EOL> '''<STR_LIT>''' <EOL> grid = None <EOL> x = None <EOL> y = None <EOL> moore = True <EOL> def __init__ ( self , grid , pos , moore = True ) : <EOL> '''<STR_LIT>''' <EOL> self . grid = grid <EOL> self . pos = pos <EOL> self . moore = moore <EOL> def random_move ( self ) : <EOL> '''<STR_LIT>''' <EOL> next_moves = self . grid . get_neighborhood ( self . pos , self . moore , True ) <EOL> next_move = random . choice ( next_moves ) <EOL> self . grid . _remove_agent ( self . pos , self ) <EOL> self . grid . _place_agent ( next_move , self ) <EOL> self . pos = next_move </s>
