Campo de Batalla  v1.0


1. Rules

	For the competition, the contestant needs to create a program that will compete against other three in a Tank Battle. A Master Program will run by turn each of the four programs.

	The game's goal is to obtain the the largest difference between the amount of tanks killed and the amount of time hit (X). The battlefield will be a 7x7 checkerboard, and the tank will occupy a 1x1 square. The lower-left coordinate is (1, 1) and the upper-right is (7, 7).

	In each turn, the tank can only make one of the following moves:
1) Move one square forward.
2) Move one square backward.
3) Turn 90 to the left or the right of the tank.
4) Shoot (this shoot has a 5 squares reach in the direction of the tank, and can kill several tanks).

	If a tank is hit by a shoot, the Master Program will send it to a safe place in the board.

	The program can be created in any language, as long as it can be compiled into a windows executable (which is the file to be sent to participate).

	Input: The input data will be read from 'datos.txt' file. It will have four lines, each with three integers and a character, separated a blank space. The first integer will be X, the difference between the amount of kills and hits from the tank. The next two integers will be the horizontal and vertical coordinates, respectively. The character will represent the orientation of the tank (N, S, E or O). The first line always represents the current tank (the one which is about to move).

	Output: The output must be written into 'salida.txt' and must have only one character, which has to be one of the following: A, R, D, I or S.
A Move forward.
R Move backwards.
D Turn 90 to the right.
I Turn 90 to the left.
S Shoot.

	If the program fails to write any of this characters, the Master Program will choose one randomly (except S).

	Important: The program must not read from any file other than 'datos.txt', or write to any file other than 'salida.txt'. Any program that fails to do so will be disqualified.

	Scores: Each participant will play three matches. The duration of each match will be determined by the amount of participants. En each round, the first, second, third and fourth places will obtain 300, 200, 100 and 0 points, respectively. In case of a tie, the points will be given evenly. To each score, 10X will be added. The winner of the tournament will be the program that has the highest score after all matches are run.



2. This version of the Master Program.

	The program included in this zip file is a text version of the Master Program. It behaves in the same way as the one that will be used in the contest, and was created so participants could test their strategies and codes.



3. How to use this program.

	Extract all files into a folder and copy your program to that same folder. Open 'personas.txt' and change any line for your info, int this order: first write the name of your program (the name cannot have spaces) and afterwards write the name of your tank (your alias).

	The Master Program needs exactly four lines with the above format to be able to run correctly (one line per tank).

	The program 'random.exe' is only included so you have something to practice with. It can be changed for any other program.

	To exit the program, press Enter (the program will run one last cycle before finishing).



4. FAQ

  a) How can I read/write from a file?
	For examples in C, C++ and Pascal, see 'demo.c', 'demo.cpp' and 'demo.pas', respectively. For other languages, we recommend consulting a reference book or talking with your programming instructor.

  b) How many times does my code has to run?
	Your program has to run only once. The Master Program will run it as many times as it's required. Because of this, your strategy cannot be based on previous moves, only on the actual state of the tanks.

  c) What happens if my program gets stuck in a loop or crashes?
	In this cases, the Master Program also gets stuck in a loop or crashes. All programs will be tested before the contest, attempting to catch this errors. Any programs that fails to run correctly will be returned and won't be able to participate unless fixed.



5. Credits

C0D3RZ do not dance! programming team and ACM Bonaterra student chapter.