summary
AI - Adding player agents¶
This is a step towards using this as a game for RL. We define multiple Agents, which follow simple rules in turn.
Random Agent¶
TODO description. Trial and error until valid move is found.
A game with random agents¶
sr = Swoggle([RandomAgent(i+1) for i in range(4)])
sr.show()
sr.move_agents()
sr.show()
Basic Player¶
Here's a way to get win rates for different agents over n games:¶
Interestingly, the one opposite the non-random player (player 2) also gets some advantage - the nearby opponents are often removed.
print(win_rates(500, [RandomAgent(i+1) for i in range(3)]+[BasicAgent(4)]))
Some convenience methods for PolicyLearners etc:¶
swoggle_to_state_vector(sr, 1, 5)
action_from_number(random.choice(range(192)), 4, sr, sr.dice())
Export¶
from nbdev.export import notebook2script
notebook2script()