Fixed incrorrect rng seeding
This commit is contained in:
parent
2132deedcd
commit
7113190e35
@ -166,6 +166,7 @@ class ColumbusEnv(gym.Env):
|
|||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
pygame.init()
|
pygame.init()
|
||||||
|
self._seed(self.env_seed)
|
||||||
self._rendered = False
|
self._rendered = False
|
||||||
self.inp = (0.5, 0.5)
|
self.inp = (0.5, 0.5)
|
||||||
self.keypress_timeout = 0
|
self.keypress_timeout = 0
|
||||||
@ -178,7 +179,6 @@ class ColumbusEnv(gym.Env):
|
|||||||
self.agent = entities.Agent(self)
|
self.agent = entities.Agent(self)
|
||||||
self.setup()
|
self.setup()
|
||||||
self.entities.append(self.agent) # add it last, will be drawn on top
|
self.entities.append(self.agent) # add it last, will be drawn on top
|
||||||
self._seed(self.env_seed)
|
|
||||||
self.observable._entities = None
|
self.observable._entities = None
|
||||||
return self.observable.get_observation()
|
return self.observable.get_observation()
|
||||||
|
|
||||||
@ -206,6 +206,8 @@ class ColumbusEnv(gym.Env):
|
|||||||
self.keypress_timeout = int(self.fps/2)
|
self.keypress_timeout = int(self.fps/2)
|
||||||
if keys[pygame.K_m]:
|
if keys[pygame.K_m]:
|
||||||
self.draw_entities = not self.draw_entities
|
self.draw_entities = not self.draw_entities
|
||||||
|
elif keys[pygame.K_r]:
|
||||||
|
self.reset()
|
||||||
else:
|
else:
|
||||||
self.keypress_timeout = 0
|
self.keypress_timeout = 0
|
||||||
else:
|
else:
|
||||||
@ -361,7 +363,7 @@ class ColumbusJustState(ColumbusEnv):
|
|||||||
|
|
||||||
|
|
||||||
class ColumbusStateWithBarriers(ColumbusEnv):
|
class ColumbusStateWithBarriers(ColumbusEnv):
|
||||||
def __init__(self, observable=observables.StateObservable(coordsAgent=True, speedAgent=False, coordsRelativeToAgent=False, coordsRewards=True, rewardsWhitelist=None, coordsEnemys=True, enemysWhitelist=None, enemysNoBarriers=True, rewardsTimeouts=False, include_rand=True), fps=30, env_seed=3.1):
|
def __init__(self, observable=observables.StateObservable(coordsAgent=True, speedAgent=False, coordsRelativeToAgent=False, coordsRewards=True, rewardsWhitelist=None, coordsEnemys=True, enemysWhitelist=None, enemysNoBarriers=True, rewardsTimeouts=False, include_rand=True), fps=30, env_seed=3.141):
|
||||||
super(ColumbusStateWithBarriers, self).__init__(
|
super(ColumbusStateWithBarriers, self).__init__(
|
||||||
observable=observable, fps=fps, env_seed=env_seed)
|
observable=observable, fps=fps, env_seed=env_seed)
|
||||||
self.aux_reward_max = 0.01
|
self.aux_reward_max = 0.01
|
||||||
@ -373,9 +375,9 @@ class ColumbusStateWithBarriers(ColumbusEnv):
|
|||||||
enemy = entities.CircleBarrier(self)
|
enemy = entities.CircleBarrier(self)
|
||||||
enemy.radius = self.random()*25+75
|
enemy.radius = self.random()*25+75
|
||||||
self.entities.append(enemy)
|
self.entities.append(enemy)
|
||||||
for i in range(3):
|
for i in range(1):
|
||||||
enemy = entities.FlyingChaser(self)
|
enemy = entities.FlyingChaser(self)
|
||||||
enemy.chase_acc = self.random()*0.4+0.3 # *0.6+0.5
|
enemy.chase_acc = 0.55 # *0.6+0.5
|
||||||
self.entities.append(enemy)
|
self.entities.append(enemy)
|
||||||
for i in range(1):
|
for i in range(1):
|
||||||
reward = entities.TeleportingReward(self)
|
reward = entities.TeleportingReward(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user