Package org.gnubridge.core

Examples of org.gnubridge.core.Deal.duplicate()


    game.getPlayer(Direction.EAST_DEPRECATED).init(
        new Card[] { Ten.of(Hearts.i()), Three.of(Hearts.i()), Two.of(Spades.i()), Eight.of(Clubs.i()) });
    game.getPlayer(Direction.SOUTH_DEPRECATED).init(
        new Card[] { Six.of(Hearts.i()), Two.of(Hearts.i()), Queen.of(Spades.i()), King.of(Clubs.i()) });

    DoubleDummySolver pruned = new DoubleDummySolver(game.duplicate());
    assertTrue(pruned.getConfigurator().isUseAlphaBetaPruning());
    pruned.search();
    assertEquals(2, pruned.getRoot().getTricksTaken(Player.WEST_EAST));
  }
View Full Code Here


    game.getPlayer(Direction.NORTH_DEPRECATED).init(new Card[] { Ace.of(Spades.i()), Eight.of(Spades.i()) });
    game.getPlayer(Direction.EAST_DEPRECATED).init(new Card[] { Ten.of(Hearts.i()), Three.of(Hearts.i()) });
    game.getPlayer(Direction.SOUTH_DEPRECATED).init(new Card[] { Six.of(Hearts.i()), Two.of(Hearts.i()) });

    game.setNextToPlay(Direction.SOUTH_DEPRECATED);
    DoubleDummySolver pruned = new DoubleDummySolver(game.duplicate());
    assertTrue(pruned.getConfigurator().isUseAlphaBetaPruning());
    pruned.search();
    assertEquals(2, pruned.getRoot().getTricksTaken(Player.WEST_EAST));

  }
View Full Code Here

    Deal firstMovePlayed = originalGame.duplicate();
    firstMovePlayed.play(firstMove);
    firstMovePlayed.printHandsDebug();
    SearchMonkey firstProxy = new SearchMonkey(first.config);
    SearchMonkey secondProxy = new SearchMonkey(second.config);
    firstProxy.runSearch(firstMovePlayed.duplicate());
    secondProxy.runSearch(firstMovePlayed.duplicate());
    firstProxy.printAsTree();
    secondProxy.printAsTree();
    assertEquals("played " + firstMove + " as recommended by " + firstProxy, firstProxy.getNorthSouthTricks(),
        secondProxy.getNorthSouthTricks());
View Full Code Here

    firstMovePlayed.play(firstMove);
    firstMovePlayed.printHandsDebug();
    SearchMonkey firstProxy = new SearchMonkey(first.config);
    SearchMonkey secondProxy = new SearchMonkey(second.config);
    firstProxy.runSearch(firstMovePlayed.duplicate());
    secondProxy.runSearch(firstMovePlayed.duplicate());
    firstProxy.printAsTree();
    secondProxy.printAsTree();
    assertEquals("played " + firstMove + " as recommended by " + firstProxy, firstProxy.getNorthSouthTricks(),
        secondProxy.getNorthSouthTricks());
    int tricksTakenIfFirstMovePlayed = firstProxy.getNorthSouthTricks();
View Full Code Here

    game.getPlayer(Direction.EAST_DEPRECATED).init(new Card[] { Ten.of(Hearts.i()), Three.of(Hearts.i()) });
    game.getPlayer(Direction.SOUTH_DEPRECATED).init(new Card[] { Six.of(Hearts.i()), Two.of(Hearts.i()) });

    game.setNextToPlay(Direction.WEST_DEPRECATED);
    game.play(Ace.of(Spades.i()));
    DoubleDummySolver pruned = new DoubleDummySolver(game.duplicate());
    Node root = new Node(null);
    pruned.examinePosition(root);
    assertNotNull(root.getBestMove());

  }
View Full Code Here

    game.getPlayer(Direction.EAST_DEPRECATED).init(new Card[] { Ten.of(Hearts.i()), Three.of(Hearts.i()) });
    game.getPlayer(Direction.SOUTH_DEPRECATED).init(new Card[] { Six.of(Hearts.i()), Two.of(Hearts.i()) });

    game.setNextToPlay(Direction.WEST_DEPRECATED);
    game.play(Ace.of(Spades.i()));
    DoubleDummySolver pruned = new DoubleDummySolver(game.duplicate());
    pruned.setTerminateIfRootOnlyHasOneValidMove(true);
    pruned.search();
    assertEquals(1, pruned.getPositionsExamined());

  }
View Full Code Here

    game.getPlayer(Direction.NORTH_DEPRECATED).init(new Card[] { Six.of(Spades.i()), Four.of(Spades.i()) });
    game.getPlayer(Direction.EAST_DEPRECATED).init(new Card[] { Ten.of(Hearts.i()), Three.of(Hearts.i()) });
    game.getPlayer(Direction.SOUTH_DEPRECATED).init(new Card[] { Six.of(Hearts.i()), Two.of(Hearts.i()) });

    game.setNextToPlay(Direction.WEST_DEPRECATED);
    DoubleDummySolver pruned = new DoubleDummySolver(game.duplicate());
    //  pruned.useAlphaBetaPruning(false);
    pruned.search();
    assertEquals(Queen.of(Spades.i()), pruned.getRoot().getBestMove().getCardPlayed());

    Deal gameWithCardsFlipped = new Deal(NoTrump.i());
View Full Code Here

        new Card[] { Ten.of(Hearts.i()), Three.of(Hearts.i()) });
    gameWithCardsFlipped.getPlayer(Direction.SOUTH_DEPRECATED).init(
        new Card[] { Six.of(Hearts.i()), Two.of(Hearts.i()) });

    gameWithCardsFlipped.setNextToPlay(Direction.WEST_DEPRECATED);
    DoubleDummySolver triangulate = new DoubleDummySolver(gameWithCardsFlipped.duplicate());

    //  triangulate.useAlphaBetaPruning(false);
    triangulate.search();
    assertEquals(Queen.of(Spades.i()), triangulate.getRoot().getBestMove().getCardPlayed());
View Full Code Here

    game.getPlayer(Direction.EAST_DEPRECATED).init(new Card[] { Ten.of(Hearts.i()), Three.of(Hearts.i()) });
    game.getPlayer(Direction.SOUTH_DEPRECATED).init(new Card[] { Six.of(Hearts.i()), Two.of(Hearts.i()) });

    game.setNextToPlay(Direction.WEST_DEPRECATED);
    game.play(Ace.of(Spades.i()));
    DoubleDummySolver pruned = new DoubleDummySolver(game.duplicate());
    pruned.search();
    assertEquals(Four.of(Hearts.i()), pruned.getRoot().getBestMove().getCardPlayed());
    Deal gameWithCardsFlipped = new Deal(NoTrump.i());
    gameWithCardsFlipped.getPlayer(Direction.WEST_DEPRECATED).init(
        new Card[] { Ace.of(Spades.i()), King.of(Spades.i()) });
View Full Code Here

    gameWithCardsFlipped.getPlayer(Direction.SOUTH_DEPRECATED).init(
        new Card[] { Six.of(Hearts.i()), Two.of(Hearts.i()) });

    gameWithCardsFlipped.setNextToPlay(Direction.WEST_DEPRECATED);
    gameWithCardsFlipped.play(Ace.of(Spades.i()));
    DoubleDummySolver triangulate = new DoubleDummySolver(gameWithCardsFlipped.duplicate());
    //triangulate.pruneAlphaBeta = false;
    triangulate.search();
    assertEquals(Four.of(Hearts.i()), triangulate.getRoot().getBestMove().getCardPlayed());

  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.