Skip to content

Halite III

Third version of Halite with inspirations from the original.

Overview

Halite III returns to the resource collection mechanics with new twists.

Resources

Implementation

codeclash.arenas.halite3.halite3.Halite3Arena

Halite3Arena(config, **kwargs)

Bases: HaliteArena

Source code in codeclash/arenas/halite3/halite3.py
33
34
35
36
37
38
39
def __init__(self, config, **kwargs):
    super().__init__(config, **kwargs)
    # Halite3's engine uses --replay-directory (hyphenated), not Halite1/2's --replaydirectory.
    # Correct the flag (rather than dropping it) so the .hlt replay lands in the round logs.
    self.run_cmd_round: str = self.run_cmd_round.replace(
        f"--replaydirectory {self.log_env}", f"--replay-directory {self.log_env}"
    )

name class-attribute instance-attribute

name: str = 'Halite3'

description class-attribute instance-attribute

description: str = ''

default_args class-attribute instance-attribute

default_args: dict = {}

submission class-attribute instance-attribute

submission: str = 'submission'

executable class-attribute instance-attribute

executable: str = './game_engine/halite'

run_cmd_round instance-attribute

run_cmd_round: str = self.run_cmd_round.replace(f'--replaydirectory {self.log_env}', f'--replay-directory {self.log_env}')

get_results

get_results(agents: list[Player], round_num: int, stats: RoundStats)
Source code in codeclash/arenas/halite3/halite3.py
57
58
59
60
61
62
63
def get_results(self, agents: list[Player], round_num: int, stats: RoundStats):
    return super().get_results(
        agents,
        round_num,
        stats,
        pattern=HALITE_WIN_PATTERN,
    )

validate_code

validate_code(agent: Player)
Source code in codeclash/arenas/halite3/halite3.py
65
66
67
68
69
70
71
72
73
def validate_code(
    self,
    agent: Player,
):
    return super().validate_code(
        agent,
        MAP_FILE_TYPE_TO_COMPILE,
        MAP_FILE_TYPE_TO_RUN,
    )