Introduction
In this game, players use their armies to fight other players' armies, capture territories, and become the last man standing. Each turn, players receive a base number of armies to use at their disposal. By capturing territories in certain regions, however, players can increase this number to give them a potential advantage later in the game. (This is essentially the same as Warlight).
All bots should be written in Java , C, or C++ (I would include other languages but don't have the software or experience for them). It is not necessary for your submission to extend a class, and you may create functions, classes, interfaces, or whatever else is necessary, and use any package or class in the standard APIs. If you are planning on creating a class or interface, please consider using an inner class or inner interface.
Please do not attempt to programmatically alter the controller or other submissions in this competition.
Gameplay
Overview
A 10x10 two-dimensional array will simulate the board, each element/cell representing a "territory". There will be 20 rounds and up to 1000 turns per round. Each turn, players will first deploy the armies they have to any of the territories they own, and then be given the opportunity to transport their armies to nearby territories in an attempt to capture their opponents' territories by attacking the armies in them. Players must deploy all their armies, but they do not have to move them if desired.
Attacking/Transferring armies
If the player desires, he/she can send armies from one territory to any of the eight adjacent ones. The board "wraps around", i.e. if a player's territory is on one side, armies from it can be transferred to an adjacent territory on the other side. When moving armies from a territory, there should still be at least one army left in that territory. For example, if a territory contains five armies, no more than four can be moved to a different territory; if a territory contains one, that army cannot move.
If a player sends n
armies from one territory to another that they own, that territory will receive n
armies.
Say a player sends n
armies from his/her territory to an opposing territory with o
armies in it. o
will decrease by n * .6
rounded to the nearest integer; however, at the same time, n
will decrease by o * .7
rounded to the nearest integer. The following rules dealing with whether or not the opposing territory has been captured will apply:
- If
o
reaches zero ANDn
is greater than 0, the player will take over the territory, which will haven
armies in it. - If both
n
ando
become zero,o
will automatically be set to 1 and the territory will not be captured. - If
o
remains greater than 0, the number of armies in the player's territory will increase byn
and the opposing territory will not be captured.
Bonuses
A group of territories will be chosen to represent a bonus; if one player owns all the territories that are part of the group, that player will receive an extra amount of armies per turn.
Bonuses have id numbers to denote different ones and values that represent the extra number of armies that a player can receive. Each round, a bonus's value will be a random number between 5 and 10, inclusive, and ten bonuses will be available on the field, each with ten territories included in the bonus.
For example, if a player that receives 5 armies per turn owns all the territories that make up a bonus with a value of 8, the player will receive 13 armies the next turn and subsequent turns. If, however, the player loses one or more of the territories that make up the bonus, he or she will receive just 5 armies per turn.
Input/Output
Your program should take input through command-line arguments, which will have the following format:
[id] [armies] [territories (yours and all adjacent ones)] [bonuses] ["X" (if first turn)]
id
andarmies
are both whole numbers.id
is your id, andarmies
is the number of armies you need to deploy to your territories. You must deploy all the armies given to you -- no more and no less.territories
is a series of strings representing the territories you own and the territories that you do not own that are adjacent to yours. The strings are in this format:[row],[col],[bonus id],[player id],[armies]
row
andcol
indicate the row and column of the board where the territory is,bonus id
is the id of the bonus that this territory is a part of,player id
is the id of the player who owns the territory, andarmies
is the number of armies contained in the territory. These are all numbers.bonuses
is a series of strings representing the bonuses on the board that you can take advantage of. The strings are in this format:[id],[armies],[territories left]
id
is the id of the bonus,armies
is the number of extra armies you can receive by owning all the territories in this bonus, andterritories left
is the number of territories in the bonus that you need to capture to receive the extra armies.
Please note that a fifth argument, an "X", will appear if it is the first turn of a round and can be used for convenience reasons.
An example of input on the first turn:
0 5 "7,6,7,-1,2 8,7,7,-1,2 7,7,7,0,5 6,6,7,-1,2 8,8,9,-1,2 6,7,7,-1,2 7,8,9,-1,2 6,8,9,-1,2 8,6,7,-1,2" "0,5,10 1,5,10 2,9,10 3,9,10 4,9,10 5,5,10 6,5,10 7,6,9 8,7,10 9,7,10" X
Your program must output two strings separated by a newline, the first of which lists the rows and columns of the territories which you want to add armies to and the number of armies you want to add to it, and the second of which lists the rows and columns of the territories you want to send armies to and the number of armies you want to send. The output may contain trailing spaces.
To specify a territory you want to add armies to, your output should follow this format:
[row],[col],[armies]
row
and col
are the row and column of the board where the territory you want to add armies to is, and armies
is the number of armies you want to add to the territory.
To specify which territories you want to send armies to, your output should follow this format:
[srow],[scol],[drow],[dcol],[armies]
srow
and scol
are the row and column of the board where the territory you want to transport armies from is, drow
and dcol
are the row and column of the board where the territory you want to send armies to is, and armies
is the number of armies you want to send. Note that if you do not want to move any armies, your program should print a space.
A sample output may be this:
0,0,5
0,0,0,1,3 0,0,1,0,3 0,0,1,1,3
In this case, the player deploys five armies to the territory at 0,0 and moves three armies from 0,0 to 0,1; three from 0,0 to 1,0; and three from 0,0 to 1,1.
Rounds and Turns
At the start of each round, all players will be given one territory located in a random spot on the board (it is possible for two or more players to start next to each other). The territories that make up a bonus may also change.
On the first turn, each player will have one territory containing five armies, and they will receive five armies they can use (this is the minimum that they can receive). All the other territories will be owned by NPCs that do not attack; each of these contain two armies and have an id of -1
.
Each turn your program will be run, and both pieces of output will be collected. The controller will apply the first piece of output, adding armies to territories, immediately; however, the controller will wait until all players have given their second piece of output, their attack/transfer commands. Once this has been completed, the commands will be shuffled randomly and then executed. Your program must provide output and terminate in one second or less in order to participate in the turn.
Scoring and Winning
For any given round, if one player remains, that player will earn 100 points. Otherwise, if 1000 turns pass and there are still multiple players, the 100 points will be divided evenly between the remaining players (i.e. 3 players remaining yields 33 points each). Whichever player has the most points at the end of the 20 rounds will win.
Submissions
Your post should include a name for the bot, the language it is written in, a brief description of it, and the code used to run it. A sample bot will be posted here as an example and will be used in the contest. You may submit as many as you wish.
Other
Your program may create, write to, and read from a file as long as the file's name is the same as the name you used for your submission. These files will be deleted prior to the beginning of a tournament but not in between rounds.
Your turn will be skipped if:
- you are eliminated (have no territories);
- your program does not print anything;
- your program does not terminate within one second;
- you deploy too few armies to your territories (deploying armies to territories you do not own will count toward this) or too many armies; or
- your output causes the controller to throw an exception.
Your attack/transfer command will not be executed if:
- your program does not give correct output;
- you choose a territory to move armies from that is not yours;
- you move zero or a negative number of armies from your territory;
- you move too many armies from your territory; or
- you choose a territory to send armies to that is not adjacent to the territory you chose to move armies from.
You can find the controller and a sample bot here. The bot will participate in the game, but it probably won't win any rounds (unless it's really lucky).
Results
Running the controller after pushing a bug fix to it, WeSwarm continues to be a force to be reckoned with. It'll take a bot with a great strategy to have a chance against it.
As of 25-08-15, 04:40 UTC
1: WeSwarm 1420
2: java Player 120
java LandGrab 120
java Hermit 120
java Castler 120
6: java RandomHalver 80
Notice!
A bug discovered by Zsw causing territories that deployed their armies after others to have a potential advantage in the game has been fixed. An edit was been pushed to the controller, so please use the existing version found using the link above.