<commit_before>Overview


The objective of the challenge is for players to defeat their opponents on the field of battle. In order to do this, they’ll need to develop an artificial intelligence capable of destroying their opponent’s tanks and capturing their base independently of any interaction from the player.

The game is comprised of a two-dimensional board made up of blocks and spaces upon which the two players will battle. Each player is equipped with two tanks and a base. The blocks prevent the players’ tanks and bullets from passing through them - not without damage to the block however as player may destroy a block by using bullets fired by their tanks.

The game ends when a player destroys their opponent’s base. If both players’ bases are destroyed or their tanks are all destroyed before any base is destroyed, then the game results in a draw.

Below is an example of a typical game board:


 

 XXX and YYY represent the tanks belonging players 1 and 2 respectively.  Tank size is 5 x 5 units.
$$$ represents a player' s base. A base takes up 1 unit.
### represents a block. A block takes up 1 unit.
* represents a bullet.                             
 

All queries relating to the Specification, Terms and Condidtions, Entry Process and Rules can be directed to <EMAIL>


Specifications

Environment and Entry Structure
Your program must be able to be compiled in either a Java 7 or a .NET 4 environment.
A Windows environment will be used as the server operating system for the challenge.
Your entry must contain a source folder as well as a start.bat file that launches the program. The start.bat file should in addition accept one parameter, which specifies the endpoint that your client should connect to.
Make sure you include a compile.bat file, we’ll use this to automatically compile your program.
Java programs must be compiled using maven and .NET projects must be compiled using msbuild.
The size of the entire entry may not exceed 5mb.

Player Interaction
The players’ AIs will interact with the game via SOAP webservices. The webservices will be provide the following functionality:

Login functionality. Players will issue a webservice command to login which responds with the board once complete. Once this has returned the game has started. Any attempts to login after the game has begun results in an immediate loss.
Game status reporting. Players may issue command to query the status of the game which includes the position of both players’ bases, the position of a player’s tanks and bullets and their recent events such as the destruction of units and mapping of blocks. Once queried, the events are cleared from the list.
Perform Actions. Players may issue a command allowing them to specify a particular tank and the action they wish to be performed by the tank. This is accomplished by the setAction method, which takes as its first argument the tank that the action must be performed by and a second argument that specifies the action to be performed. The tank’s action is then set to the action specified by the player.

A copy of the wsdl used to for this challenge can be found here.

Game Lifecycle and Constraints
The game commences as soon as two players have been logged in.
The game begins with the players tanks and bases distributed symmetrically across one of eight boards.
Tanks have the following attributes:
A position which denotes their position as (x,y) coordinate pairs on the board.
A direction which determines the direction the tank is facing and hence where bullets are fired.
An action which determines which of six possible actions a tank may take. The available actions are:
UP - Move up one grid cell.
DOWN - Move down one grid cell.
LEFT – Move left one grid cell.
Right – Move right one grid cell.
FIRE – Fire bullets in the specified direction.
NONE- Perform no action.
Bullets are destroyed once they collide with another object and in addition will destroy the following: 
A row of five blocks in the direction consistent with how the bullets struck the blocks.
The image below shows an example of a bullet traveling left (indicated by the red arrow) and colliding with a wall at block (5,5). 
This collision results in blocks (5,3),(5,4), (5,5) (5,6), (5,7) being destroyed.


Any tank, including tanks belonging to the player that fired the bullets (friendly fire).
Any base, friendly or enemy.
Other bullets, which results in both bullets being destroyed.
The game proceeds in “ticks” which are a period of three seconds. During each tick the following events take place:
Bullets that have been fired are moved and collisions are checked for.
Bullets and tanks are moved and collision are checked for.
All tanks in the firing state are fired and their bullets are added to the field.
Collisions are checked for.
A base may be destroyed by collision with either bullets or tanks.

Quick-start Guide
This quick reference guide is intended to get you up and running with the project setup for the challenge, whether you choose to implement your solution in Java or .NET.


Java
If you plan to develop your entry in Java then you are also required to provide batch files to build your program using maven and to run your project. The basic outline of these batch files is presented here.


Maven
java -cp target/battlematrix-1.0-SNAPSHOT.jar za.co.entelect.competition.App

You will need a copy of Maven.
This is a free piece of software with a South African mirror that can be located here. 
Install it as per the included README.txt file – that is, extract it and then add the /bin folder from the extracted directory to your Windows path and make sure your JAVA_HOME variable is set to the root of your JDK (eg, C:\Program Files\Java\jdk1.7.0_05)
You can verify that it is working by running mvn --version from your command line – this should print out something similar to:
Apache Maven 3.0.5 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: C:\maven\bin\..
Java version: 1.7.0_05, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_05\jre
Default locale: en_ZA, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"


To generate a basic project structure, such as a “Hello World” structure, run
mvn archetype:generate -DgroupId=za.co.entelect.competition 
-DartifactId=battlematrix -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

This will generate the standard project structure for a “Hello World” program with the name of battlematrix for you. This can then be built by changing into the folder corresponding to the artifact ID and running mvn package. The contents of your compile.bat file for the purposes of this project would also be mvn package.
To run this example program, you would then enter:
 java -cp target/battlematrix-1.0-SNAPSHOT.jar za.co.entelect.competition.App
To create the start.bat file, modify the java line above to take in a command line argument as a batch file. This accomplidhed by adding a %1 to the java line, indicating that the first parameter of the batch file shold be passed to the java program. The contents of start.bat for this basic example would then be:
java -cp target/battlematrix-1.0-SNAPSHOT.jar za.co.entelect.competition.App %1


.NET
If you plan to develop your entry using a .NET language then you are also required to provide batch files to compile and run your project. However, most of the .NET generation is more easily done via graphical utilities such as Visual Studio Express which can be downloaded for free. Once it is installed, follow the wizard in order to create your project. All that remains for your entry is to create the batch files that will compile and run your project.

For this example, take the name of the .proj file that is generated by Visual Studio to be Entelect.proj. In order to build this project, the compile.bat file should contain the following

MSBuild.exe Entelect.proj

As long as this is called from within a Visual Studio command prompt, this will build your project. The created files are placed inside the bin folder. The start.bat file should then contain, depending on the chosen name of your application,

<path to your application in the bin folder>.exe %1

This will run your program whilst supplying as a command line parameter the first input to your start.bat file.<commit_msg>Updated rules.txt<commit_after>Overview


The objective of the challenge is for players to defeat their opponents on the field of battle. In order to do this, they’ll need to develop an artificial intelligence capable of destroying their opponent’s tanks and capturing their base independently of any interaction from the player.

The game is comprised of a two-dimensional board made up of blocks and spaces upon which the two players will battle. Each player is equipped with two tanks and a base. The blocks prevent the players’ tanks and bullets from passing through them - not without damage to the block however as player may destroy a block by using bullets fired by their tanks.

The game ends when a player destroys their opponent’s base. If both players’ bases are destroyed or their tanks are all destroyed before any base is destroyed, then the game results in a draw.

Below is an example of a typical game board:

Example Grid
 

 XXX and YYY represent the tanks belonging players 1 and 2 respectively.  Tank size is 5 x 5 units.
$$$ represents a player' s base. A base takes up 1 unit.
### represents a block. A block takes up 1 unit.
* represents a bullet.                             
 

All queries relating to the Specification, Terms and Conditions, Entry Process and Rules can be directed to <EMAIL>


Specifications

Environment and Entry Structure
Your program must be able to be compiled in either a Java 7 or a .NET 4 environment.
A Windows environment will be used as the server operating system for the challenge.
Your entry must contain a source folder as well as a start.bat file that launches the program. The start.bat file should in addition accept one parameter, which specifies the endpoint that your client should connect to.
Make sure you include a compile.bat file, we’ll use this to automatically compile your program.
Java programs must be compiled using maven and .NET projects must be compiled using msbuild.
The size of the entire entry may not exceed 5mb.
A beta release of a test server can be downloaded here. This can be used to test a player locally. Please be sure to read the included readme.txt for instructions on how to set this up.
Each match will take place on one of eight maps - these will gradually be revealed.

Player Interaction
The players’ AIs will interact with the game via SOAP webservices. The webservices will be provide the following functionality:

Login functionality. Players will issue a webservice command to login which responds with the board once complete. Once this has returned the game has started. Any attempts to login after the game has begun results in an immediate loss.
Game status reporting. Players may issue command to query the status of the game which includes the position of both players’ bases, the position of a player’s tanks and bullets and their recent events such as the destruction of units and mapping of blocks. Once queried, the events are cleared from the list.
Perform Actions. Players may issue a command allowing them to specify a particular tank and the action they wish to be performed by the tank. This is accomplished by the setAction method, which takes as its first argument the tank that the action must be performed by and a second argument that specifies the action to be performed. The tank’s action is then set to the action specified by the player.

A copy of the wsdl used to for this challenge can be found here. 

Game Lifecycle and Constraints
The game commences as soon as two players have been logged in.
The game begins with the players tanks and bases distributed symmetrically across one of eight boards.
Tanks have the following attributes:
A position which denotes their position as (x,y) coordinate pairs on the board.
A direction which determines the direction the tank is facing and hence where bullets are fired.
An action which determines which of six possible actions a tank may take. The available actions are:
UP - Move up one grid cell.
DOWN - Move down one grid cell.
LEFT – Move left one grid cell.
Right – Move right one grid cell.
FIRE – Fire bullets in the specified direction.
NONE- Perform no action.
Each tank may have only a single bullet in the air at any time. Once that bullet is destroyed, another may be fired. If a fire command is issued while a bullet is in play, that tank will perform no action that turn.
Bullets are destroyed once they collide with another object and in addition will destroy the following: 
A row of five blocks in the direction consistent with how the bullets struck the blocks.
The image below shows an example of a bullet traveling left (indicated by the red arrow) and colliding with a wall at block (2,5). 
This collision results in blocks (2,3),(2,4), (2,5) (2,6), (2,7) being destroyed.


Any tank, including tanks belonging to the player that fired the bullets (friendly fire).
Any base, friendly or enemy.
Other bullets, which results in both bullets being destroyed.
The game proceeds in “ticks” which are a period of three seconds. During each tick the following events take place in order:
First, bullets that have been fired and are already in play are moved and collisions are checked for.
Next, bullets are moved again  and then tanks are moved and collision are checked for.
All tanks in the firing state are fired and their bullets are added to the field. A bullet starts in the centre of a tank, in front of it (in the direction the tank is facing)  and is moved for the first time on the next tick. However, collisions are checked for immediately.
Lastly, collisions are checked for.
A base may be destroyed by collision with either bullets or tanks.
Once the time limit, indicated by the endGamePoint field in the login return object, is hit, the end of the game will be forced. This is done by marking columns as OUT_OF_BOUNDS, starting from the columns on the far left and right and then marking an additional column moving towards the centre each tick.

Quick-start Guide
This quick reference guide is intended to get you up and running with the project setup for the challenge, whether you choose to implement your solution in Java or .NET.


Java
If you plan to develop your entry in Java then you are also required to provide batch files to build your program using maven and to run your project. The basic outline of these batch files is presented here.


Maven
java -cp target/battlematrix-1.0-SNAPSHOT.jar za.co.entelect.competition.App

You will need a copy of Maven.
This is a free piece of software with a South African mirror that can be located here. 
Install it as per the included README.txt file – that is, extract it and then add the /bin folder from the extracted directory to your Windows path and make sure your JAVA_HOME variable is set to the root of your JDK (eg, C:\Program Files\Java\jdk1.7.0_05)
You can verify that it is working by running mvn --version from your command line – this should print out something similar to:
Apache Maven 3.0.5 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: C:\maven\bin\..
Java version: 1.7.0_05, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_05\jre
Default locale: en_ZA, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"


To generate a basic project structure, such as a “Hello World” structure, run
mvn archetype:generate -DgroupId=za.co.entelect.competition 
-DartifactId=battlematrix -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

This will generate the standard project structure for a “Hello World” program with the name of battlematrix for you. This can then be built by changing into the folder corresponding to the artifact ID and running mvn package. The contents of your compile.bat file for the purposes of this project would also be mvn package.
To run this example program, you would then enter:
 java -cp target/battlematrix-1.0-SNAPSHOT.jar za.co.entelect.competition.App
To create the start.bat file, modify the java line above to take in a command line argument as a batch file. This is accomplished by adding a %1 to the java line, indicating that the first parameter of the batch file should be passed to the java program. The contents of start.bat for this basic example would then be:
java -cp target/battlematrix-1.0-SNAPSHOT.jar za.co.entelect.competition.App %1


.NET
If you plan to develop your entry using a .NET language then you are also required to provide batch files to compile and run your project. However, most of the .NET generation is more easily done via graphical utilities such as Visual Studio Express which can be downloaded for free. Once it is installed, follow the wizard in order to create your project. All that remains for your entry is to create the batch files that will compile and run your project.

For this example, take the name of the .proj file that is generated by Visual Studio to be Entelect.proj. In order to build this project, the compile.bat file should contain the following

MSBuild.exe Entelect.proj

As long as this is called from within a Visual Studio command prompt, this will build your project. The created files are placed inside the bin folder. The start.bat file should then contain, depending on the chosen name of your application,

<path to your application in the bin folder>.exe %1

This will run your program whilst supplying as a command line parameter the first input to your start.bat file.
{'fraction_non_alphanumeric': 0.03626855600539811, 'fraction_numerical': 0.009221772379667117, 'mean_word_length': 4.201813395729745, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6142023', 'n_tokens_mistral': 4398, 'n_tokens_neox': 4171, 'n_words': 2908}