Right now the wild card color gets assigned randomly when it gets drawn from the deck:
# draw a wild card
if card.type == 'wild':
card.color = self.np_random.choice(UnoCard.info['color'])
and the player is then able to pick any wild card color:
if wild_flag == 0:
wild_flag = 1
legal_actions.extend(WILD)
however, whatever color the player picks, the original random card color gets played. This PR fixes the problem by changing the card color during action execution.
This also makes the dqn training more effective against the random agent. Previous results:
0 experiments/uno_dqn_result/model.pth 0.0174
1 random -0.0174
After the change:
--> Running on the CPU
0 experiments/uno_dqn_result/model.pth 0.0294
1 random -0.0294
Right now the wild card color gets assigned randomly when it gets drawn from the deck:
and the player is then able to pick any wild card color:
however, whatever color the player picks, the original random card color gets played. This PR fixes the problem by changing the card color during action execution.
This also makes the dqn training more effective against the random agent. Previous results:
After the change: