<s> from pelita import datamodel <EOL> from pelita . graph import AdjacencyList , NoPathException , diff_pos <EOL> from pelita . player import AbstractPlayer , SimpleTeam <EOL> class FoodEatingPlayer ( AbstractPlayer ) : <EOL> def set_initial ( self ) : <EOL> self . adjacency = AdjacencyList ( self . current_uni . reachable ( [ self . initial_pos ] ) ) <EOL> self . next_food = None <EOL> def goto_pos ( self , pos ) : <EOL> return self . adjacency . a_star ( self . current_pos , pos ) [ - <NUM_LIT:1> ] <EOL> def get_move ( self ) : <EOL> if ( self . next_food is None <EOL> or self . next_food not in self . enemy_food ) : <EOL> if not self . enemy_food : <EOL> return datamodel . stop <EOL> self . next_food = self . rnd . choice ( self . enemy_food ) <EOL> try : <EOL> next_pos = self . goto_pos ( self . next_food ) <EOL> move = diff_pos ( self . current_pos , next_pos ) <EOL> return move <EOL> except NoPathException : <EOL> return datamodel . stop <EOL> def factory ( ) : <EOL> return SimpleTeam ( "<STR_LIT>" , FoodEatingPlayer ( ) , FoodEatingPlayer ( ) ) </s>
