Resolve #12: Game environment should make consistent use of PlayerAction enum - #13
Open
thowell332 wants to merge 2 commits into
Open
Conversation
- Rename TOGGLE to TOGGLE_CART and rename SELECT to PICKUP to make the PlayerAction enum consistent with the accepted action strings and the README - Python enums values can already be accessed using their string representation, so there is no need to maintain an explicit mapping
- Rather than maintain a separate list of action commands, socket_env.py should use the PlayerAction enum - The get_names method is for convenience when looking up an enum name
thowell332
force-pushed
the
issue-12/consistent-use-of-player-action-enum
branch
from
January 25, 2025 18:59
6fc607f to
b14554e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #12
Description of Changes:
TOGGLEvs.TOGGLE_CARTandSELECTvs.PICKUP. SinceTOGGLE_CARTis already in use throughout the codebase by several agents, and is the action name that is currently supported bysocket_env.py, I chose to continue using this name. Since theSELECTandPICKUPactions do not appear to be in use by any agents, I chose to use thePICKUPaction name to be more consistent with the internal function names in the game environment.socket_env.pyto use the common representation of player actions defined inenums/player_action.py. I removed theACTION_COMMANDSlist defined insocket_env.pyand added a helper classmethodget_namestoPlayerActionto return an equivalent list.Risks:
SELECTtoPICKUPis a breaking change, since it changes the interface to the game environment, so any agents that are currently using theSELECTaction will need to be updated to usePICKUPinstead.Notes:
astar_path_planner_*.pyorsocket_agent*.py. These agents only expose a subset of the available player actions defined inPlayerAction(namely, they excludeSELECTand/orRESET). If this is not a requirement, then the agent code could also be updated to use thePlayerActionenum directly.