package net.ciklum.icfpc11.player import net.ciklum.icfpc11.controller.Controller import net.ciklum.icfpc11.domain.Game import net.ciklum.icfpc11.parser.ArgumentCompiler import net.ciklum.icfpc11.parser.ArgumentParser import net.ciklum.icfpc11.parser.Command import static net.ciklum.icfpc11.domain.Card.* import static net.ciklum.icfpc11.parser.Application.LEFT import static net.ciklum.icfpc11.parser.Application.RIGHT /** * Very simple bot that kills the 0th cell * @author mym */ class Bot45 { private static List commands = [ // 16moves = 255 in 0th new Command(RIGHT, 0, zero), // 0 new Command(LEFT, 0, succ),// 1 new Command(LEFT, 0, dbl), // 2 new Command(LEFT, 0, succ),// 3 new Command(LEFT, 0, dbl), // 6 new Command(LEFT, 0, succ),// 7 new Command(LEFT, 0, dbl), // 14 new Command(LEFT, 0, succ),// 15 new Command(LEFT, 0, dbl), // 30 new Command(LEFT, 0, succ),// 31 new Command(LEFT, 0, dbl), // 62 new Command(LEFT, 0, succ),// 63 new Command(LEFT, 0, dbl), // 126 new Command(LEFT, 0, succ),// 127 new Command(LEFT, 0, dbl), // 254 new Command(LEFT, 0, succ),// 255 // 10moves prepare attack in 177 new Command(RIGHT, 177, zero), // 0 new Command(LEFT, 177, succ), // 1 new Command(LEFT, 177, attack),// attack(1) new Command(LEFT, 177, K), // K(attack(1)) new Command(LEFT, 177, S), // S(K(attack(1))) new Command(RIGHT, 177, get), // S(K(attack(1)), get) new Command(RIGHT, 177, zero), // attack(1, 255) new Command(LEFT, 177, K), // K(attack(1,255)) new Command(LEFT, 177, S), // S(K(attack(1,255))) new Command(RIGHT, 177, get), // S(K(attack(1,255)), get) // 11moves to help in 211 new Command(RIGHT, 211, zero), // 0 new Command(LEFT, 211, succ), // 1 new Command(LEFT, 211, succ), // 2 new Command(LEFT, 211, help), // help(2) new Command(LEFT, 211, K), // K(help(2)) new Command(LEFT, 211, S), // S(K(help(2))) new Command(RIGHT, 211, succ), // S(K(help(2)), succ) new Command(RIGHT, 211, zero), // help(2, 1) new Command(LEFT, 211, K), // K(help(2,1)) new Command(LEFT, 211, S), // S(K(help(2,1))) new Command(RIGHT, 211, get), // S(K(help(2,1)), get) // copy 255 to 1st new Command(RIGHT, 1, zero), // 0 new Command(LEFT, 1, get), // 255 // 5moves to ~8000 in 0 new Command(LEFT, 0, dbl), // 510 new Command(LEFT, 0, dbl), // 1020 new Command(LEFT, 0, dbl), // 2040 new Command(LEFT, 0, dbl), // 4080 new Command(LEFT, 0, dbl), // 8160 // execute help new Command(RIGHT, 211, zero), // I (effect: help(2,1,8160)) // 16000 in 0th new Command(LEFT, 0, dbl), // 16320 // THIS IS SPARTA!!! execute attack new Command(RIGHT, 177, zero), // I (effect: attack(1,255,16320)) // copy 255 to 0th new Command(RIGHT, 0, zero), // 0 new Command(LEFT, 0, succ), // 1 new Command(LEFT, 0, get), // 255 (from 1st cell) new Command(LEFT, 1, dec), // dec the 0th (255-255) cell // loop new Command(RIGHT, 77, zero), // 0 new Command(LEFT, 77, get), // 255 (from oth cell) new Command(LEFT, 77, dec) // dec the 0th (255-255) cell ] static void main(String[] args) { boolean hisTurn = args[0] == '1' def game = Game.instance def controller = new Controller() def parser = new ArgumentParser() def compiler = new ArgumentCompiler() def input = new InputStreamReader(System.in) def output = System.out if (hisTurn) { Command command = parser.parse(input.readLine(), input.readLine(), input.readLine()) controller.hisTurn(game, command) } int i = 0 while (true) { def myturn = commands[i] i++ if (i >= commands.size()) { i -= 3 } controller.myTurn(game, myturn) output.print compiler.compile(myturn) output.flush() Command command = parser.parse(input.readLine(), input.readLine(), input.readLine()) controller.hisTurn(game, command) } } }