Package driftingdroids.model

Examples of driftingdroids.model.KeyMakerLong


    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
                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 long key2 = kml2.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.KeyMakerLong

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.