AI & Machine Learning

The Halite competition returns, to teach ML enthusiasts how to design for intelligent machines

Halite

Halite is Two Sigma’s annual artificial intelligence programming competition, deployed on Google Cloud Platform, in which players write programs (or “bots”) to compete in an original online multiplayer game. Since 2016, Halite has enabled more than 7,000 professionals and students around the world to learn and apply machine learning and other advanced algorithms in a dynamic game setting. Two Sigma built, open sourced, and runs Halite for community outreach and learning, providing an accessible and immersive way for our community to engage with AI.

Introducing Halite III

The third Halite season runs from October, 2018 to January, 2019, and builds on the momentum of last year’s challenge, which attracted students and professionals from nearly 1,000 organizations and over 100 countries. Player-submitted bots, written in over 20 programming languages, played millions of games.

This year’s Halite III programming challenge, like previous Halite games, is simple to explain and difficult to solve: it is explicitly designed to be played by competitors’ programs. The challenge has an exploratory resource management premise. Participants’ bots build and control ships that navigate an ocean map collecting halite, an energy resource. The bot that collects the most halite from its opponents, wins a game.

The game has a branching factor many times that of the game of Go, due to its multi-agent nature and the wide range of possible bot actions. How many ships should a player initially build? Where should they travel? Should they avoid or interact with other players’ ships? This open-ended structure leaves room for creative strategies and leads to innumerable paths to victory. Perhaps more importantly, it combines thousands of years of game history with more recent advancements in game-playing machines. If you’d like to learn more, check out the game’s homepage.

Playing to learn

Two Sigma launched Halite to share the creative, collaborative, and intellectual spirit of its internal competitions, which often pair humans with machines, with the community. One of Two Sigma’s better-known internal competitions was their robotic air hockey challenge, back in 2016. Two Sigma have found that these competitions expose engineers and quantitative researchers to new problems, languages, and tools that prove relevant to their work. Halite players similarly will have the opportunity to leverage their professional skills to tackle the challenges of the game, and Two Sigma welcomes the opportunity to meet players who demonstrate strong and creative strategies.

The global competition, supported by secure and scalable Google Cloud resources, enables collaborative, round-the-clock engagement with Halite’s open-ended game environment. Tools and resources increase the accessibility and learning potential of the platform.

Experienced and beginner programmers alike can develop bots on their own machines or on the game’s site. Two Sigma- and community-contributed starter kits will help players get started building their bots in their preferred programming language. Interactive tutorials introduce bot-building principles and gameplay strategies. A real-time web-based code editor enables players to visualize and simulate games with their bots before submission.

  # This game object contains the initial game state.
game = hlt.Game()
# Respond with your name.
game.ready("MyPythonBot")
 
while True:
    # Get the latest game state.
    game.update_frame()
    # You extract player metadata and the updated map metadata here for convenience.
    me = game.me
    game_map = game.game_map
 
    # A command queue holds all the commands you will run this turn.
    command_queue = []
 
    for ship in me.get_ships():
        # For each of your ships, move randomly if the ship is on a low halite location or the ship is full.
        #   Else, collect halite.
        if game_map[ship.position].halite_amount < constants.MAX_HALITE / 10 or ship.is_full:
            command_queue.append(
                ship.move(random.choice(["n", "s", "e", "w"])))
        else:
            command_queue.append(ship.stay_still())
 
    # If you're on the first turn and have enough halite, spawn a ship.
    # Don't spawn a ship if you currently have a ship at port, though.
    if game.turn_number <= 1 and me.halite_amount >= constants.SHIP_COST and not game_map[me.shipyard].is_occupied:
        command_queue.append(game.me.shipyard.spawn())
 
    # Send your moves back to the game environment, ending this turn.
    game.end_turn(command_queue)

The game’s learning curve is such that Halite dabblers will be able to quickly improve their bots, and committed competitors will be able to dive deep into strategy. Just as there are a number of paths to victory in the game, there are a number of varied skills you can put to use in Halite.

Pairing humans and machines

The game’s depth makes machine learning strategies viable. The previous Halite games saw players apply supervised learning, reinforcement learning, and other computationally intensive techniques in their bot building. For the second year in a row, Two Sigma, with Google Cloud’s support, will provide interested players with GPU-enabled instances to train machine-learning bots. To promote beginner experimentation with ML and other techniques, Two Sigma has put together a series of tutorials and resources.

Reinforcement learning (RL) is one area Halite competitors may be particularly interested in this year, due to the simulation-like nature of the game—and RL’s recent successes in gaming applications, such as DeepMind’s exploits in StarCraft and OpenAI’s efforts at the Dota 2 world championship. GPUs enable a Halite player to train a bot to explore and seek rewards in the game environment with RL.

The millions of games run over the course of the three-month competition will create a unique training dataset that participants may download from Google Cloud Storage and use in a number of creative, computationally intensive ways.

Why Halite

Uncertain, simulated environments like the Halite game are unique tools for those who build or are interested in building algorithms (or even machines) to function in the uncertain real world. Two Sigma encourages anyone interested in engaging with AI and machine learning to participate.

It’s easy to sign up and ultimately find yourself on the leaderboard! Players can participate as individuals or on teams, and any wins will also contribute to the player’s organization ranking. Previous Halite programming challenges were particularly successful thanks to their robust forum communities and community starter kit and tooling contributions, and the Halite team looks forward to another dynamic season this year.