Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Halite helpers #43

Merged
merged 21 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6693070
Started building out halite helper classes
harrisse Jun 3, 2020
62fe6d5
Finished initial pass at helper classes for Halite
harrisse Jun 3, 2020
deea1c8
Removed Point class, cleaned up board population, and added board pri…
harrisse Jun 3, 2020
ac0f18e
Added more convenience properties for Halite, filled in some comments…
harrisse Jun 3, 2020
562d241
Added basic collision detection and action formation logic to helper …
harrisse Jun 3, 2020
bf52ab8
General helper cleanup, fixed a bug with serializing shipyard actions…
harrisse Jun 4, 2020
091e6b8
Calculate remaining halite as actions occur, add unprotected action s…
harrisse Jun 5, 2020
99b90a2
Move to board-based interpreter and remove collision prevention in fa…
harrisse Jun 9, 2020
6a7d1a7
Made raw Board constructor hidden
harrisse Jun 9, 2020
64f644b
More progress in board <-> interpreter refactor and cleanup
harrisse Jun 10, 2020
e430a67
Merge branch 'master' into halite-helpers
harrisse Jun 11, 2020
ea4dafd
Commented up halite, fixed a couple small halite bugs
harrisse Jun 11, 2020
8a2dc09
Style updates
harrisse Jun 11, 2020
bec5a5b
Swapped north and south, handle step updates in Board
harrisse Jun 12, 2020
7b6fbb9
Made non-top-level .observation properties private
harrisse Jun 12, 2020
d027e91
Reorder halite rules
harrisse Jun 12, 2020
1ae58cb
Deposit halite after collision
harrisse Jun 12, 2020
69a0c6e
Readd move costs, handle depositing halite after collision, rank play…
harrisse Jun 12, 2020
781cf62
PR updates
harrisse Jun 12, 2020
228deb6
Fix random bot
harrisse Jun 12, 2020
7cc6a37
Rewrote random agent
harrisse Jun 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions kaggle_environments/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ def runner(raw, message, environment, debug=False):
run_agent(agent, message)


class Agent():

class Agent:
def __init__(self, raw, configuration, environment, id=None, debug=False):
self.id = id or str(uuid.uuid1())
self.configuration = configuration
Expand Down
11 changes: 7 additions & 4 deletions kaggle_environments/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def run(self, agents):
Returns:
list of list of dict: The agent states of all steps executed.
"""
if self.state == None or len(self.steps) == 1 or self.done:
if self.state is None or len(self.steps) == 1 or self.done:
self.reset(len(agents))
if len(self.state) != len(agents):
raise InvalidArgument(
Expand Down Expand Up @@ -251,7 +251,6 @@ def render(self, **kwargs):
out = self.renderer(*args[:self.renderer.__code__.co_argcount])
if mode == "ansi":
return out
print(out)
elif mode == "html" or mode == "ipython":
window_kaggle = {
"debug": get(kwargs, bool, self.debug, path=["debug"]),
Expand Down Expand Up @@ -548,8 +547,12 @@ def __agent_runner(self, agents):
agents[i] = self.agents[agent]

# Generate the agents.
agents = [Agent(a, self.configuration, self.name, debug=self.debug) if a !=
None else None for a in agents]
agents = [
Agent(a, self.configuration, self.name, debug=self.debug)
if a is not None
else None
for a in agents
]

# Have the agents had a chance to initialize (first non-empty act).
initialized = [False] * len(agents)
Expand Down
5 changes: 0 additions & 5 deletions kaggle_environments/envs/halite/halite.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
"agents": [1, 2, 4],
"configuration": {
"episodeSteps": 400,
"halite": {
"description": "Deprecated, please use startingHalite instead.",
"type": "integer",
"default": 24000
},
"startingHalite": {
"description": "The starting amount of halite available on the board.",
"type": "integer",
Expand Down
Loading