Game Rules

Overview

This guide gives a detailed description of how the precise rules of the Halite game work. It is highly recommended that you have already read "Introducing Halite" before reading this document.

The Game

During a move, every piece you control can be given one of five moves: to move NORTH, EAST, SOUTH, WEST, or to remain STILL. When a piece move STILL for a turn, it will permanently increase its Strength by the Production of the tile it sits on.

Players gain pieces by simply moving their own pieces over Sites on the map. When a piece moves off of a Site, it leaves behind a piece with an identical Owner and with a Strength of 0, in doing so expanding the size of their territory.

When pieces from the same player try to occupy the same site, the resultant piece has the sum of their strengths. Strengths are capped at 255, so if two pieces with a strength of 150 were to both attempt to occupy the same square, the resultant piece would still have a strength of 255.

When pieces from opposing players try to occupy either the same or cardinally adjacent sites (diagonals are not included), the battle will be resolved according to the relative strengths of the pieces, as each piece decreases the strength of every adjacent or coinciding opposing piece by its own strength. Pieces with a strength of 0 or less are removed from the game, excepting pieces with a strength of 0 which have not engaged in combat during that turn.

Notice how in the above example, the pieces combined prior to fighting.

Because a piece damages all adjacent enemy pieces, if a piece is killed while attacking multiple pieces, it will output (often significantly) more damage than it had strength. This is referred to as "overkill" and means that bots can use their pieces tactically to their own advantage. This is shown in the below examples:

The map is initialized by the environment to have productions and strengths. Combat with map squares works identically to combat with other players except only applies on that square; empty map squares neither apply damage to nor take damage from adjacent squares.

Players should note that the map does wrap around; if a piece at the top of the map moves North, it will reappear on the bottom of the map, and pieces on the top and bottom of the map will engage in combat (provided that they are in the same column).

The origin of the map (the point at coordinates (0, 0)) is the north west (top left) corner of the map.

Players are scored according to the reverse of the order in which they are destroyed. The player last standing wins, whereas the player which was destroyed first comes in last. Bots are scored relatively; in a game with many players it is far better to come in second than to come in last.

The game ends if one of two conditions are met:

  • Only one player has any pieces left.
  • 10 * sqrt(WIDTH * HEIGHT) turns have been played. Consequently, a small map may end after a few hundred turns, whereas a large map could take thousands.

The maximum number of turns is generally high enough that only the best-matched of bots will reach the turn limit; the majority of games will end before the turn limit is reached. In the event that the turn limit is reached or multiple bots are destroyed on the same turn, they are ranked based on their territory at that point in the game. If there is a tie in the amount of territory each bot possesses, the full territory integral is used as the tiebreaker, although this is a rare occurence.

Bot Initialization

At the start of the game, each bot is sent some information (accessed using getInit in the starter packages):

  • Their own tag within the map - that is, which player they are.
  • The initial map state.

Bots are permitted to use time at the beginning of the game to initialize. This initialization might include (but is in no way limited to) getting the initial map and player tag, identifying important, high-production regions on the map, identifying the locations of neighboring players, planning the bot's initial expansion strategy, and/or compiling a model. Once bots are done initializing (before their time is up), they should send a response (sendInit in the starter packages) with their own player name, used for human identification purposes.

Turns

After all bots have finished setting up, the environment will do the following until endgame conditions are met.

  1. Send the present gamestate - map and messages - to all players.
  2. Receive moves from the players.
  3. Kill bots whose responses take longer than their remaining allotted time.
  4. Add strength to pieces which choose to remain where they are.
  5. Simultaneously move (and combine if necessary) all player's pieces. The capping of strengths to 255 occurs here.
  6. Simultaneously damage (and remove if damage equals or exceeds strength) all player's pieces. All pieces will output damage equivalent to their strength when starting this phase, and the damage will apply to all coinciding or adjacent enemy squares.
  7. Check if endgame conditions have been met.

One should note that because all pieces damage all adjacent enemy pieces, if a piece is killed while attacking multiple pieces, it will output (often significantly) more damage than it had strength. This is referred to as "overkill" and means that bots can use their pieces tactically to their own advantage.

Timeouts

Bots are given 15 seconds to initialize and 1 second for every subsequent turn. Every bot's clock starts ticking once the environment sends its message (be it initialization or frame) to the bot and resets once the environment receives the newline character marking the end of the bot's response. If a bot's clock hits zero, it is ejected from the game and deemed to have lost. It's pieces become part of the map.

Maps

Maps are randomly generated at the start of each game. The generator does the following:

  1. Tries to match the given width and height as closely as it can while still creating a symmetric map. Maps are guaranteed to be the given size or smaller in each dimension; never larger.
  2. Tries to create interesting maps in which there are patches of high production squares and patches of low production squares, with fairly low noise on the small scale.
  3. Always creates symmetric maps. Specifically, the generator generates a chunk of the map and then tesselates, reflects, and shifts it to produce the entire map.

Replay Files

Once a game ends, the environment will output a replay file. See here for more information regarding the replay file format.


This is a reproduction. | Original Site Available Here | Reproduction Github