package net.ciklum.icfpc11.controller.runners import net.ciklum.icfpc11.domain.Game import net.ciklum.icfpc11.controller.AiPlayer import net.ciklum.icfpc11.controller.ConsolePlayer import net.ciklum.icfpc11.controller.Controller /** * blabla * @author vic */ @Typed class GameStarter { static void main(String[] args) { boolean hisTurn = (args.length > 0 && args[0] == '1') AiPlayer me = new AiPlayer(hisTurn ? 'Player 1' : 'Player 0') ConsolePlayer other = new ConsolePlayer(hisTurn ? 'Player 0' : 'Player 1') def game = hisTurn ? Game.push(other, me) : Game.push(me, other) def controller = new Controller(game) // let's try to be crash-safe :) // though, we don't know whose turn we crashed on - so 50/50 we will continue. for (;;) { try { controller.go() return } catch (NullPointerException e) { // e.printStackTrace(System.err) } } } }