- Destroy the enemy headquarters.
- After
100 turns, you have more military power than your opponent. The military power is computed by the sum of the cost of all of your units + your amount of gold.
A Code of Ice And Fire
856 CodinGamers in the A Code of Ice And Fire arena
Approved by reCurse Astrobytes an anonymous CodinGamer
A higher resolution is required to access the IDE
- 103
Statement
This is a league based challenge.
Wood leagues should be considered as a tutorial which lets players discover the different rules of the game.In Bronze league, all rules will be unlocked and the real challenge will begin.
Starter AIs are available in the Starter Kit. They can help you get started with coding your own bot. Check out the community events this week and have fun coding!
The Goal
Rules
The map
The map is a grid of size
Both players start with headquarters (HQ) from opposite edges of the map (
A map cell can be either:
- void (
# ): not a playable cell. - neutral (
. ): doesn't belong to any player. - captured (
O orX ): belongs to a player. - inactive (
o orx ): belongs to a player but inactive.
Territory ownership
Throughout the game, each player will capture cells to enlarge their territory. A player territory is composed of all the cells owned by the player that are active.
A cell is said to be active if and only if the cell is connected to the headquarters. That is, there exists a path of owned cells from the headquarters to this cell.
The red territory is composed of 6 cells. The 3 red-dark cells are now inactive because the blue player interrupted part of this territory. By capturing, for example, the cell marked by an X, the red player can make these cells active again.
Income
At the beginning of each turn, a player gains or loses gold based on their income. A player has
Every turn, army units cost some income (upkeep).
- Level
1 units reduce income by1 per unit.
If a player has negative income and cannot pay their upkeep using their gold, all of the player's units die and the player's gold is reset to
Armies
Army units can move to capture cells and to destroy opponent's buildings and units.
Level 1 units can be trained using the command
Level 1 units can destroy other level 1 units and HQ. Only the attacking unit survives.
Each unit can only move one cell per turn by using the command
It's not possible to train or move on a cell with a friendly building or unit on it.
An army unit cannot move on the same turn it's trained.
When using
To train a unit or move it on an enemy unit or building, the attacking unit must be able to destroy the defending unit or building. If so, the attacking unit always survives. Else, the action is invalid; nothing happens.
If a unit is on an inactive cell at the beginning of a turn, the unit is instantly destroyed.
Level | 1 |
---|---|
Recruitment cost | 10 |
Upkeep | 1 |
Can kill units level | 1 |
Can destroy | HQ |
Order of actions
All actions are processed sequentially. Invalid actions are ignored.
- You fail to provide a valid command in time.
- You provide a unrecognized command.
Game Input
Line 1: one integer numberMineSpots: the number of mine spots on the map. Mine spots will be used from Wood1 league onwards.
Next numberMineSpots lines: two integers- x and y: coordinates of the mine spot.
Line 1: an integer gold, the player's amount of gold.
Line 2: an integer income, the player's income.
Line 3: an integer opponentGold, the opponent's amount of gold.
Line 4: an integer opponentIncome: the opponent's income.
Next
# : void. : neutralO : owned and active cello : owned and inactiveX : active opponent cellx : inactive opponent cell
Next line: buildingCount: the amount of buildings on the map.
Next buildingCount lines: four integers
- owner
0 : Owned1 : Enemy
- buildingType: the type of building
0 : HQ
- x and y: the building's coordinates.
Next line:unitCount: the amount of units on the map.
Next unitCount lines: five integers
- owner
0 : Owned1 : Enemy
- unitId: this unit's unique id
- level: always
1 (only in this league). - x and y: the unit's coordinates.
MOVE id x y TRAIN level x y where level can only be1 WAIT to do nothing.
You can add a message to display in the viewer by appending the command
Allotted response time to output on the first turn is ≤
What is in store in the higher leagues?
The extra rules available in higher leagues are:- In Wood 2, you can train army units of level 2 and 3.
- In Wood 1, you can build mines.
- In Bronze, you can build towers.
A higher resolution is required to access the IDE