Skip to content

Commit 2fe2dd0

Browse files
authored
Merge pull request #155 from HaliteChallenge/add-player-to-docs
Add accessing other players documentation (fixes #154)
2 parents 9966466 + 8a89371 commit 2fe2dd0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

website/learn-programming-challenge/api-docs.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ This API Documentation refers to objects shipped with Halite III starter kits:
6464

6565
<br/>
6666

67+
6768
#### PLAYER
6869
Players have an `id`, a `shipyard`, a `halite_amount`, and dictionaries of ships and dropoffs as member variables.
6970

@@ -91,6 +92,15 @@ Players have an `id`, a `shipyard`, a `halite_amount`, and dictionaries of ships
9192

9293
<br/>
9394

95+
* **Access Other Players**
96+
97+
Players can access all players' ships, shipyard, and dropoffs. `game.players` is a dictionary of player ids keys to player objects in the game.
98+
99+
`for player in game.players:` loops over each player in the game by player_id key, including you.
100+
101+
<br/>
102+
103+
94104
#### SHIP
95105
Ships carry up to 1,000 halite as cargo and can be issued one command per turn via the command queue. Ships automatically deposit their cargo when over the shipyard or dropoff points. If two ships collide, both are destroyed; their cargo falls back into the sea at the collision site.
96106

0 commit comments

Comments
 (0)