With the modification to GameState #51 and #52 , BotPlayer importing State from rl is creating a circular import loop.
To solve this, and make the interface for choosing and taking actions more consistent across Player and its subclasses as well as Policy and its subclasses, the legal available actions will determined higher in the decision chain, and the choosers will only be allowed to choose from the legal actions passed.
enumerate_legal_actions happens in request_action and the legal actions are then passed to choose_action with the state
playable birds will be determined in play_a_bird, then the playable choices are passed to choose_a_bird_to_play with the state
choices for drawing (from the tray or the deck) will be determined in draw_a_bird, then the legal choices are passed to choose_a_bird_to_draw with the state.
Typically, the state is not needed for the HumanPlayer (as they infer state from the game render), and the BotPlayer only needs it if its not following the RandomPolicy.
This will solve the circular import loop and make the class interfaces more manageable, readable, and extendable when returning to the MCTS implementation.
With the modification to GameState #51 and #52 , BotPlayer importing State from rl is creating a circular import loop.
To solve this, and make the interface for choosing and taking actions more consistent across Player and its subclasses as well as Policy and its subclasses, the legal available actions will determined higher in the decision chain, and the choosers will only be allowed to choose from the legal actions passed.
enumerate_legal_actions
happens inrequest_action
and the legal actions are then passed tochoose_action
with the stateplay_a_bird
, then the playable choices are passed tochoose_a_bird_to_play
with the statedraw_a_bird
, then the legal choices are passed tochoose_a_bird_to_draw
with the state.Typically, the state is not needed for the HumanPlayer (as they infer state from the game render), and the BotPlayer only needs it if its not following the RandomPolicy.
This will solve the circular import loop and make the class interfaces more manageable, readable, and extendable when returning to the MCTS implementation.