public static void main(String[] args) throws InstantiationException, IllegalAccessException {
        int boardSize = 10;
        int timeout = 20000;
        for (String arg : args) {
            System.err.println(arg);
        }
        PrintStream origOut = System.out;
        System.setOut(System.err);
        System.err.println(args.length);
        if (args.length < 2) {
            System.err.printf("Arguments: first-player-jar second-player-jar [board-size=%d] [timeout=%d]\n", boardSize, timeout);
            return;
        }
        if (args.length >= 3) {
            boardSize = Integer.parseInt(args[2]);
        }
        if (args.length >= 4) {
            timeout = Integer.parseInt(args[3]);
        }
        Class<? extends Player>[] cl = new Class[2];
        for (int i = 0; i < cl.length; ++i) {
            cl[i] = JarPlayerLoader.load(args[i]);
        }
        System.setSecurityManager(new SecurityManager());
        BoardFactory boardFactory = new SnortBoardFactory();
        Map<String, Object> config = new HashMap<>();
        config.put(BoardFactory.BOARD_SIZE, boardSize);
        boardFactory.configure(config);
        GameEngine g = new GameEngineImpl(boardFactory);
        g.setTimeout(timeout);
        Player[] p = new Player[cl.length];
        String result = "";
        for (int i = 0; i < cl.length; ++i) {
            p[i] = cl[i].newInstance();
            g.addPlayer(p[i]);
            result += getName(p[i]) + ";";
        }
        String error = "";
        Color winner;
        try {
            winner = g.play(new Callback() {
                @Override
                public void update(Color c, Board b, Move m) {
                    System.out.println(b);
                }
            });
        } catch (RuleViolationException ex) {
            winner = Player.getOpponent(ex.getGuilty());
            error = "\"" + escape(ex.toString()) + "\"";
        }
        result += "\"" + winner + "\";" + error + ";";
        origOut.println(result);
    }