Package driftingdroids.model

Examples of driftingdroids.model.Board


    private static void runTestRandom1000() throws InterruptedException {
        final Date startDate = new Date();
       
        final int numGames = 1000;
       
        final Board theBoard = Board.createBoardGameID("0765+42+2E21BD0F+93");
       
        int maxMoves = -1;
        String maxSolution = "";
        for (int i = 1; i <= numGames; ++i) {
           
            theBoard.setRobotsRandom();
            final Solver theSolver = Solver.createInstance(theBoard);
            final Solution theSolution = theSolver.execute().get(0);
            final int moves = theSolution.size();
           
            //System.err.println(i + " usedMem=" + (getBytesUsed() >> 20) + " MiB  " + theSolver.getKnownStatesNumber());
           
            if ((0 == i % 100) || (moves > maxMoves)) {
                String msg = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
                msg += "  gamesSolved=" + i + "/" + numGames + "  maxMoves=" + (moves > maxMoves ? moves : maxMoves);
                System.out.println(msg);
            }
            if (moves > maxMoves) {
                maxMoves = moves;
                maxSolution = theBoard.toString() + "\n" + theSolver.toString() + '\n';
                System.out.println(maxSolution);
            } else {
                System.out.println("\n***** run #" + i + "  -  current maxMoves still is " + maxMoves + " *****\n");
            }
        }
View Full Code Here


   
   
    @SuppressWarnings("unused")
    private static void runTestKeyDepthMap() throws InterruptedException {
//        final Board board = Board.createBoardRandom(5);
        final Board board = Board.createBoardGameID("0765+42+2E21BD0F+93");
       
        System.err.println("GameID\t#Sol\t#Mov\tmsGnrc\tmsSpcl\tMBgnrc\tMBspcl");
        for(;;) {
            board.setRobotsRandom();
//            board.setGoalRandom();
            final StringBuilder sb = new StringBuilder();
            sb.append(board.getGameID()).append('\t');
           
            KeyDepthMapFactory.setDefaultClass(KeyDepthMapTrieGeneric.class);
            final SolverIDDFS solverGeneric = (SolverIDDFS)Solver.createInstance(board);
            final List<Solution> solutionsGeneric = solverGeneric.execute();
           
View Full Code Here

    private static void runTestRandom1000() throws InterruptedException {
        final Date startDate = new Date();
       
        final int numGames = 1000;
       
        final Board theBoard = Board.createBoardGameID("0765+42+2E21BD0F+93");
       
        int maxMoves = -1;
        String maxSolution = "";
        for (int i = 1; i <= numGames; ++i) {
           
            theBoard.setRobotsRandom();
            final Solver theSolver = Solver.createInstance(theBoard);
            final Solution theSolution = theSolver.execute().get(0);
            final int moves = theSolution.size();
           
            //System.err.println(i + " usedMem=" + (getBytesUsed() >> 20) + " MiB  " + theSolver.getKnownStatesNumber());
           
            if ((0 == i % 100) || (moves > maxMoves)) {
                String msg = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
                msg += "  gamesSolved=" + i + "/" + numGames + "  maxMoves=" + (moves > maxMoves ? moves : maxMoves);
                System.out.println(msg);
            }
            if (moves > maxMoves) {
                maxMoves = moves;
                maxSolution = theBoard.toString() + "\n" + theSolver.toString() + '\n';
                System.out.println(maxSolution);
            } else {
                System.out.println("\n***** run #" + i + "  -  current maxMoves still is " + maxMoves + " *****\n");
            }
        }
View Full Code Here

   
   
    @SuppressWarnings("unused")
    private static void runTestKeyDepthMap() throws InterruptedException {
//        final Board board = Board.createBoardRandom(5);
        final Board board = Board.createBoardGameID("0765+42+2E21BD0F+93");
       
        System.err.println("GameID\t#Sol\t#Mov\tmsGnrc\tmsSpcl\tMBgnrc\tMBspcl");
        for(;;) {
            board.setRobotsRandom();
//            board.setGoalRandom();
            final StringBuilder sb = new StringBuilder();
            sb.append(board.getGameID()).append('\t');
           
            KeyDepthMapFactory.setDefaultClass(KeyDepthMapTrieGeneric.class);
            final SolverIDDFS solverGeneric = (SolverIDDFS)Solver.createInstance(board);
            final List<Solution> solutionsGeneric = solverGeneric.execute();
           
View Full Code Here

    @SuppressWarnings("unused")
    private static void runTestKeyInt() throws InterruptedException {
        System.err.println("runTestKeyInt");
        for (;;) {
            final Board board = Board.createBoardRandom(4);

            final KeyMakerInt kmi1 = KeyMakerInt.createInstance(board.getNumRobots(), board.sizeNumBits, (board.getGoal().robotNumber < 0));
            final KeyDepthMap kdm1 = KeyDepthMapTrieSpecial.createInstance(board, true);

            final KeyMakerInt kmi2 = KeyMakerInt.createInstance(board.getNumRobots(), board.sizeNumBits, (board.getGoal().robotNumber < 0));
            final KeyDepthMap kdm2 = new KeyDepthMapTrieGeneric(board.getNumRobots() * board.sizeNumBits);

            for (int i = 0;  i < 10000000;  ++i) {
                board.setRobotsRandom();
                final int[] state = board.getRobotPositions();

                final int key1 = kmi1.run(state);
                final boolean res1a = kdm1.putIfGreater(key1, 5);   // true or false
                final boolean res1b = kdm1.putIfGreater(key1, 5);   // always false
                final boolean res1c = kdm1.putIfGreater(key1, 4);   // always false
View Full Code Here

    @SuppressWarnings("unused")
    private static void runTestKeyLong() throws InterruptedException {
        System.err.println("runTestKeyLong");
        for (;;) {
            final Board board = Board.createBoardRandom(5);

            final KeyMakerLong kml1 = KeyMakerLong.createInstance(board.getNumRobots(), board.sizeNumBits, (board.getGoal().robotNumber < 0));
            final KeyDepthMap kdm1 = KeyDepthMapTrieSpecial.createInstance(board, false);

            final KeyMakerLong kml2 = KeyMakerLong.createInstance(board.getNumRobots(), board.sizeNumBits, (board.getGoal().robotNumber < 0));
            final KeyDepthMap kdm2 = new KeyDepthMapTrieGeneric(board.getNumRobots() * board.sizeNumBits);

            for (int i = 0;  i < 10000000;  ++i) {
                board.setRobotsRandom();
                final int[] state = board.getRobotPositions();

                final long key1 = kml1.run(state);
                final boolean res1a = kdm1.putIfGreater(key1, 5);   // true or false
                final boolean res1b = kdm1.putIfGreater(key1, 5);   // always false
                final boolean res1c = kdm1.putIfGreater(key1, 4);   // always false
View Full Code Here

    private static void runTestRandom1000() throws InterruptedException {
        final Date startDate = new Date();
       
        final int numGames = 1000;
       
        final Board theBoard = Board.createBoardGameID("0765+42+2E21BD0F+93");
       
        int maxMoves = -1;
        String maxSolution = "";
        for (int i = 1; i <= numGames; ++i) {
           
            theBoard.setRobotsRandom();
            final Solver theSolver = Solver.createInstance(theBoard);
            final Solution theSolution = theSolver.execute().get(0);
            final int moves = theSolution.size();
           
            //System.err.println(i + " usedMem=" + (getBytesUsed() >> 20) + " MiB  " + theSolver.getKnownStatesNumber());
           
            if ((0 == i % 100) || (moves > maxMoves)) {
                String msg = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
                msg += "  gamesSolved=" + i + "/" + numGames + "  maxMoves=" + (moves > maxMoves ? moves : maxMoves);
                System.out.println(msg);
            }
            if (moves > maxMoves) {
                maxMoves = moves;
                maxSolution = theBoard.toString() + "\n" + theSolver.toString() + '\n';
                System.out.println(maxSolution);
            } else {
                System.out.println("\n***** run #" + i + "  -  current maxMoves still is " + maxMoves + " *****\n");
            }
        }
View Full Code Here

   
   
    @SuppressWarnings("unused")
    private static void runTestKeyDepthMap() throws InterruptedException {
//        final Board board = Board.createBoardRandom(5);
        final Board board = Board.createBoardGameID("0765+42+2E21BD0F+93");
       
        System.err.println("GameID\t#Sol\t#Mov\tmsGnrc\tmsSpcl\tMBgnrc\tMBspcl");
        for(;;) {
            board.setRobotsRandom();
//            board.setGoalRandom();
            final StringBuilder sb = new StringBuilder();
            sb.append(board.getGameID()).append('\t');
           
            KeyDepthMapFactory.setDefaultClass(KeyDepthMapTrieGeneric.class);
            final SolverIDDFS solverGeneric = (SolverIDDFS)Solver.createInstance(board);
            final List<Solution> solutionsGeneric = solverGeneric.execute();
           
View Full Code Here

    @SuppressWarnings("unused")
    private static void runTestKey2() throws InterruptedException {
        for (;;) {
            //final Board board = Board.createBoardGameID("0765+42+2E21BD0F+93");
            final Board board = Board.createBoardRandom(4);

            final KeyMakerInt kmi1 = KeyMakerInt.createInstance(board.getNumRobots(), board.sizeNumBits, (board.getGoal().robotNumber < 0));
            final KeyDepthMap kdm1 = new KeyDepthMapTrieSpecial(board);

            final KeyMakerInt kmi2 = KeyMakerInt.createInstance(board.getNumRobots(), board.sizeNumBits, (board.getGoal().robotNumber < 0));
            final KeyDepthMap kdm2 = new KeyDepthMapTrieGeneric(board.getNumRobots() * board.sizeNumBits);

            for (int i = 0;  i < 10000000;  ++i) {
                board.setRobotsRandom();
                final int[] state = board.getRobotPositions();

                final int key1 = kmi1.run(state);
                final boolean res1a = kdm1.putIfGreater(key1, 5);   // true or false
                final boolean res1b = kdm1.putIfGreater(key1, 5);   // always false
                final boolean res1c = kdm1.putIfGreater(key1, 4);   // always false
View Full Code Here

                            final String data = JOptionPane.showInputDialog(frame,
                                    L10N.getString("msg.CreateBoardFromDump.input.message"),
                                    L10N.getString("msg.CreateBoardFromDump.input.title"),
                                    JOptionPane.PLAIN_MESSAGE);
                            if ((null != data) && (0 != data.length())) {
                                final Board newBoard = Board.createBoardGameDump(data);
                                if (null != newBoard) {
                                    board = newBoard;
                                    if (board.isFreestyleBoard()) {
                                        jtabEditBoard.setSelectedIndex(1);
                                    }
View Full Code Here

TOP

Related Classes of driftingdroids.model.Board

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.