Package driftingdroids.model

Examples of driftingdroids.model.KeyMakerInt


    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
                final boolean res1d = kdm1.putIfGreater(key1, 6);   // always equal to res1a
                if ((true == res1b) || (true == res1c)) {
                    System.err.println("unexpected result 'true' of kdm1.putIfGreater() for state " + Arrays.toString(state));
                }
                if ((res1a != res1d)) {
                    System.err.println("unexpected results 'not equal' of kdm1.putIfGreater() for state " + Arrays.toString(state));
                }

                final int key2 = kmi2.run(state);
                final boolean res2a = kdm2.putIfGreater(key2, 5);   // true or false
                final boolean res2b = kdm2.putIfGreater(key2, 5);   // always false
                final boolean res2c = kdm2.putIfGreater(key2, 4);   // always false
                final boolean res2d = kdm2.putIfGreater(key2, 6);   // always equal to res2a
                if ((true == res2b) || (true == res2c)) {
View Full Code Here


    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
                final boolean res1d = kdm1.putIfGreater(key1, 6);   // always equal to res1a
                if ((true == res1b) || (true == res1c)) {
                    System.err.println("unexpected result 'true' of kdm1.putIfGreater() for state " + Arrays.toString(state));
                }
                if ((res1a != res1d)) {
                    System.err.println("unexpected results 'not equal' of kdm1.putIfGreater() for state " + Arrays.toString(state));
                }

                final int key2 = kmi2.run(state);
                final boolean res2a = kdm2.putIfGreater(key2, 5);   // true or false
                final boolean res2b = kdm2.putIfGreater(key2, 5);   // always false
                final boolean res2c = kdm2.putIfGreater(key2, 4);   // always false
                final boolean res2d = kdm2.putIfGreater(key2, 6);   // always equal to res2a
                if ((true == res2b) || (true == res2c)) {
View Full Code Here

TOP

Related Classes of driftingdroids.model.KeyMakerInt

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.