MechMania 16

Game Overview

MechMania 16 is a turn-based strategy game designed for 4 programs to compete. The game occurs on a square 2D grid and revolves around fighting your opponents over the ownership of terrain. Programs are then scored based on how many tiles they own at the end of the game.

The Map

The map for MechMania is a 2D arrangement of tiles. Each tile has a terrain type: Plains, Ocean, or Mountains.

Plains are passable by soldiers and are owned by a single player. Only a single player may have soldiers on a plains tile at once. Owning these tiles is your goal. Ownership of a tile is determined by the presence of at least one unit on the tile, and moving the last unit from the tile results in loss of ownership.

Ocean tiles are used by submarines, but are not owned. Ocean tiles may have an arbitrary number of submarines on them. It is allowable for two different programs to have submarines on the same tile.

Mountains are impassable by all unit types and are merely an obstacle. They cannot be owned by a player.

Manhattan distance is used for all distance calculations. Manhattan distance is defined as: abs(x1 - x2) + abs(y1 - y2), where abs is the absolute value function.

There is no diagonal movement at all. The borders of the map do NOT wrap around. So if you try moving past the northernmost edge, you will not end up in the southern part of the map.

Directions are provided for moving units, but sometimes you will need to interact with the coordinate system. The translation is:

Competeition maps are square and symmetric, including starting positions. Your starting position is not significant beyond being your initial tile and having an initial unit. Maps are typically 25 by 25.

50 gold is received per tile owned per turn.

Units

Your basic unit is a robotic soldier of 4 attributes:

The minimal unit must have 1 HP, 0 damage, 0 range, and 0 vision. Units may have up to 1 million (1,000,000) in all options, but that may not be practical.

Units are initially summoned on a tile that you control (of your choice) with the options you specify. From then, they can move, attack, and be loaded onto submarines. Their cost in gold is a function of the above options.

Units may perform a single action per turn. Invalid actions do not count against this.

There is a limit of units that a player may own: 9 per plains tile, and 9 per submarine.

Submarines

Submarines are your way around the front. In the Universe where MechMania 16 occurs, the planets have a peculiar property of having a core of water. This allows submarines to transport units to any ocean tile on the map adjacent to a plains tile (aka beach) in a constant time of four turns.

Submarines are initially summoned on any ocean tile. They can load one unit per turn onto them, begin movement, or land upon a beach ("attach" to an adjacent tile of plains).

Due to the way the submarine lands on the enemy beach, it is single use. When submarines are attached, the units on board become visible and valid targets, and those units can move off and attack. Units may not re-board an attached submarine. For attach to succeed, a submarine must be on an ocean tile that is adjacent to plains. You may only have one submarine attached to a tile at any given time (this is a per-player limit, so every player may have a submarine attached to a particular tile). A tile is available at the beginning of the turn after the last unit was removed from a submarine.

Submarines do not control tiles, and have no parameters that affect their cost. Submarines have a cargo capacity of 9 and can only load one unit per turn.

Submarines may only perform a single action per turn. Loading a unit on-board uses up the action for both the submarine and the unit, and both must have an available action.

Submarines may not be interrupted while moving. You will know that they are "submerged".

The API

You are given the choice of three APIs: C++, Java, or Python. These APIs provide the networking code and some game logic that you need to play a game with the server. Each API varies somewhat but provide approximately the same functionality. API-specific documentation is provided within the API and as HTML.

Your task is to implement the logic and decide how to act under different circumstances. Good luck.

Actions

You will send a series of actions to the server. All players submit actions to the server at the same time, from the same game state information. These actions are then processed one at a time, starting with move actions. Once all move actions have been processed then all summon commands are processed. You cannot summon a unit on a tile that you just moved to in that same turn unless you previously owned that tile. The turns happen as a round-robin between players. Summons all happen at the same time. As an example:

TURN 1

TURN 2

There is no penalty for invalid actions, and some of them may happen due to the actions of other players.

The actions are:

Unit Costs

Submarines cost 200 gold.

For units, the base cost is 50 gold. This base cost is added to the rest of the cost is the following added together.

Victory / Defeat

Games run 500 turns. If you attempt to play out of turn, crash, or lose all of your units, you will no longer be in the game, the former because you will be removed, the second because your client will disconnect, and the third because you will be unable to do anything useful.

Victory is determined by how many tiles you own at the end of the game.

Other Information

See the competition file for information on details of the competition.