Rocket Bots
The year is 3024. People have become too scarce a resource to risk in war, so combat has shifted to the robots. Your task is to construct a bot like no other, who's rockets will rain destruction down on your foes and shoot down all incoming threats.
Gameplay
Bots
Gameplay takes place on a 10x15 grid. Your bot is located off the bottom edge, and has three slots at spots 6,7 and 8 of the grid. Your opponent is located at the top of the grid, with three slots directly opposite yours.
Rockets
From any of these slots, you can fire a rocket, assuming the slot has not been destroyed. A rocket consists of a list of directions that is given to it when created, and once fired these directions cannot be changed. Each turn, the rocket will consume the top of the list, and move in that direction. Rockets move simultaneously. If two rockets end in the same tile, they will both explode. If a rocket runs out of commands, it will explode. If a rocket runs out of fuel, after 100 moves, it will explode. When a rocket explodes, it will remain in that tile for 5 turns, causing any other rockets that move there to explode as well.
Note: Because of the simultaneous movement, two rockets can pass each other without exploding, as long as they do not both end a turn in the same tile.
Goal
The goal of each match is to destroy your opponents slots while keeping yours alive. A rocket can be fired from any live slot you have, and is given a path designated by you before it is fired. You fire a rocket every second turn, meaning rockets will move twice before you can fire another one. A duel lasts for 200 turns, or until one bots slots are all destroyed.
Scoring
At the end of the match, you get one point for each live slot you have, and one point for each opponents slot you destroyed. This means it is a zero-sum game, and 6 points will be awarded each match.
A round robin will be run so that each bot faces each other bot once. If any bots use RNGs, then each matchup will be 1000 duels instead.
Implementation
Code for the competition can be found here: https://github.com/Cain93/RocketBots
Each submission should extend the Bot
class. You must override the fireRocket
method. This method receives a grid array of Rockets, Rocket[][]
, that represents the gameboard. You are always located at the bottom of the grid, with slots at spots [-1][6]
, [-1][7]
, [-1][8]
. On the grid, unoccupied spots will be represented with null
. If a rocket exists in a tile, you can identify who it belongs to by accessing the dis
field. "^" is your rocket, and "v" is your opponents.
You must return a LinkedList of Integers that gives the instructions for your rocket. To move up, use 0. To move up and right, use 1, just right, use 2, etc all the way to 7 for up and left. The rocket will move in the order you push Integers. For example, the following code will make the rocket move upwards a few turns, zig-zag a few turns and then detonate.
LinkedList<Integer> moves = new LinkedList<Integer>();
moves.push(0);
moves.push(0);
moves.push(0);
moves.push(1);
moves.push(7);
moves.push(1);
moves.push(7);
To change which slot to fire the rocket from, change the curSlot
field. 0 is your leftmost slot, and 2 is your rightmost. To check if a slot is destroyed, use getSlot(int slotNumber)
.
If a rocket ends a turn on a slot, that slot will be destroyed. You do not need to manually detonate the rocket.
Note: Rockets spawn at the location of the slot fired from, but will move once before collisions are evaluated. So if you fire a rocket from slot 0, and the first move is right (2), then you will destroy your own middle slot. However, up and right (1) is a safe move.
If you want to name your bot, override the name()
method.
Bots will be re-built for each duel, so any static variables will be reset.
Good Luck!
May your rockets fly true and your opponents be nothing but smoldering scraps of metal.
Hint:
Purposefully detonating rockets to create explosions is an easier way to defend than trying to shoot down opponents rockets.
Example Bot
package bots;
import java.util.LinkedList;
import mechanics.*;
public class SimpleBot extends Bot {
public String name(){
return "Simple";
}
public LinkedList<Integer> fireRocket(Rocket[][] g){
LinkedList<Integer> l = new LinkedList<Integer>();
for(int i = 0; i < 12; i++){
l.push(0);
}
return l;
}
}
Scores
Scores from 6-24
Simple: 900
Zigzagoon: 3654
Wall-E: 3606
Tortoise: 2248
3 Shot: 2334
HatTrickBot: 4287
Sniper: 2973
SideShooter: 2491
Terminator: 4835
StraightShot: 3378
Defender: 4570
MoreDakka: 4324