alshedivat / alshedivat/lola

Player blue and red are not currently symmetrical

Aperta
#9 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Jupyter Notebook
Stelle
156
Fork
38
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

In https://github.com/alshedivat/lola/blob/master/lola/envs/coin_game.py

The symmetry is broken in favor of player red.
When the two players move at the same time on the cell with the coin, player red has the advantage to pick the coin (always pick before player blue)

In my implementation (where I do not use batch):
Currently we have:
```
if self.red_coin:
if self._same_pos(self.red_pos, self.coin_pos):
generate = True
reward_red = 1
reward_blue = 0
elif self._same_pos(self.blue_pos, self.coin_pos):
generate = True
reward_red = -2
reward_blue = 1
else:
reward_red = 0
reward_blue = 0

else:
if self._same_pos(self.red_pos, self.coin_pos):
generate = True
reward_red = 1
reward_blue = -2
elif self._same_pos(self.blue_pos, self.coin_pos):
generate = True
reward_red = 0
reward_blue = 1
else:
reward_red = 0
reward_blue = 0
```
To have the symmetry between red and blue, this should be changed to:
```
if self.red_coin:
if self._same_pos(self.red_pos, self.coin_pos) and self._same_pos(self.blue_pos, self.coin_pos):
if np.random.randint(0, 2):
generate = True
reward_red = 1
reward_blue = 0
else:
generate = True
reward_red = -2
reward_blue = 1
elif self._same_pos(self.red_pos, self.coin_pos):
generate = True
reward_red = 1
reward_blue = 0
elif self._same_pos(self.blue_pos, self.coin_pos):
generate = True
reward_red = -2
reward_blue = 1
else:
reward_red = 0
reward_blue = 0

else:
if self._same_pos(self.red_pos, self.coin_pos) and self._same_pos(self.blue_pos, self.coin_pos):
if np.random.randint(0, 2):
generate = True
reward_red = 1
reward_blue = -2
else:
generate = True
reward_red = 0
reward_blue = 1
elif self._same_pos(self.red_pos, self.coin_pos):
generate = True
reward_red = 1
reward_blue = -2
elif self._same_pos(self.blue_pos, self.coin_pos):
generate = True
reward_red = 0
reward_blue = 1
else:
reward_red = 0
reward_blue = 0
```

I can do a push request if needed.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.