Exemplo n.º 1
0
    def __init__(self,
                 grid_size=[15, 15],
                 unit_size=10,
                 unit_gap=1,
                 snake_size=3,
                 n_snakes=1,
                 n_foods=1,
                 random_init=True,
                 start_coord=None,
                 food_pos=None):

        if random_init:
            assert food_pos is None  # added 20190519 in mod19 version

        self.grid_size = grid_size
        self.unit_size = unit_size
        self.unit_gap = unit_gap
        self.snake_size = snake_size
        self.n_snakes = n_snakes
        self.n_foods = n_foods
        self.viewer = None
        self.action_space = Discrete(4)
        self.random_init = random_init
        self.start_coord = start_coord  # added 20190519 in mod19 version
        self.food_pos = food_pos
Exemplo n.º 2
0
    def __init__(self,
                 grid_size=[10, 10],
                 unit_size=10,
                 unit_gap=1,
                 snake_size=3,
                 n_snakes=1,
                 n_foods=1,
                 random_init=True):
        self.grid_size = grid_size
        self.unit_size = unit_size
        self.unit_gap = unit_gap
        self.snake_size = snake_size
        self.n_snakes = n_snakes
        self.n_foods = n_foods
        self.food_cord = None
        self.viewer = None
        self.action_space = Discrete(4)
        self.random_init = random_init

        # Terminate or punish stuck agents
        self.count = 0
        self.end_episode = 1000

        # Spaces
        self.observation_space = spaces.Box(
            0, 255, [grid_size[0] * unit_size, grid_size[1] * unit_size, 3])
Exemplo n.º 3
0
 def __init__(self, grid_size=[15,15], unit_size=10, unit_gap=1, snake_size=3, n_snakes=1, n_foods=1, random_init=True):
     self.grid_size = grid_size
     self.unit_size = unit_size
     self.unit_gap = unit_gap
     self.snake_size = snake_size
     self.n_snakes = n_snakes
     self.n_foods = n_foods
     self.viewer = None
     self.action_space = Discrete(4)
     self.random_init = random_init
 def __init__(self, grid_size=[25,25], unit_size=10, unit_gap=1, snake_size=5, n_snakes=3, n_foods=2, random_init=True):
     self.grid_size = grid_size
     self.unit_size = unit_size
     self.unit_gap = unit_gap
     self.snake_size = snake_size
     self.n_snakes = n_snakes
     self.n_foods = n_foods
     self.viewer = None
     self.action_space = Discrete(4)
     self.last_obs = None
     self.last_grid = None
     self.random_init = random_init
Exemplo n.º 5
0
 def __init__(self,
              grid_size=[30, 30],
              unit_size=10,
              unit_gap=1,
              snake_size=2,
              n_snakes=1,
              n_foods=1,
              random_init=True):
     self.grid_size = grid_size
     self.unit_size = unit_size
     self.unit_gap = unit_gap
     self.snake_size = snake_size
     self.n_snakes = n_snakes
     self.n_foods = n_foods
     self.viewer = None
     self.action_space = Discrete(4)
     self.random_init = random_init
     #Defined observation space
     #self.observation_space = spaces.Box(low=np.array([0]*11), high=np.array([1]*11), dtype=np.bool)
     self.observation_space = spaces.Tuple(
         (spaces.Discrete(2), spaces.Discrete(2), spaces.Discrete(2),
          spaces.Discrete(2), spaces.Discrete(2), spaces.Discrete(2),
          spaces.Discrete(2), spaces.Discrete(2), spaces.Discrete(2),
          spaces.Discrete(2), spaces.Discrete(2)))