examples/robots.py
def advance_robots(self):
        '''Produces a new game state in which the robots have advanced
        towards the player by one step. Handles the robots crashing into
        one another too.'''

        # move the robots towards the player
        self = lens.robots.Each().call_step_towards(self.player)(self)
        # robots in the same place are crashes
        self = lens.crashes.call_union(duplicates(self.robots))(self)
        # remove crashed robots
        self = lens.robots.modify(lambda r: list(set(r) - self.crashes))(self)

        return self
def advance_robots(self):
        '''Produces a new game state in which the robots have advanced
        towards the player by one step. Handles the robots crashing into
        one another too.'''

        # move the robots towards the player
        self = lens.robots.Each().call_step_towards(self.player)(self)
        # robots in the same place are crashes
        self = lens.crashes.call_union(duplicates(self.robots))(self)
        # remove crashed robots
        self = lens.robots.modify(lambda r: list(set(r) - self.crashes))(self)

        return self
def advance_robots ( self ) : # move the robots towards the player self = lens . robots . Each ( ) . call_step_towards ( self . player ) ( self ) # robots in the same place are crashes self = lens . crashes . call_union ( duplicates ( self . robots ) ) ( self ) # remove crashed robots self = lens . robots . modify ( lambda r : list ( set ( r ) - self . crashes ) ) ( self ) return self
Produces a new game state in which the robots have advanced
        towards the player by one step. Handles the robots crashing into
        one another too.
Produces a new game state in which the robots have advanced towards the player by one step . Handles the robots crashing into one another too .