Examples of Deal


Examples of org.gnubridge.core.Deal

    }
    System.out.println("");
  }

  private void preInitializeGame13Tricks() {
    Deal g = new Deal(null);
    GameUtils.initializeSingleColorSuits(g, 13);
    g.setHumanPlayer(g.getSouth());
    System.out.println("Human's hand: " + g.getSouth().getHand());
    Deal.setPreInitializedGame(g);
  }
View Full Code Here

Examples of org.gnubridge.core.Deal

    System.out.println("Human's hand: " + g.getSouth().getHand());
    Deal.setPreInitializedGame(g);
  }

  private void preInitializeGameWithSingleColorSuits() {
    Deal g = new Deal(null);
    GameUtils.initializeSingleColorSuits(g, TRICKS_PER_DEAL);
    g.setHumanPlayer(g.getWest());
    System.out.println("Human's hand: " + g.getWest().getHand());
    Deal.setPreInitializedGame(g);
  }
View Full Code Here

Examples of org.gnubridge.core.Deal

    System.out.println("Human's hand: " + g.getWest().getHand());
    Deal.setPreInitializedGame(g);
  }

  private void preInitializeRandomGame() {
    Deal g = new Deal(null);
    GameUtils.initializeRandom(g, TRICKS_PER_DEAL);
    g.setHumanPlayer(g.getNorth());
    System.out.println("West's hand: " + g.getWest().getHand());
    System.out.println("Human's hand: " + g.getNorth().getHand());
    System.out.println("East's hand: " + g.getEast().getHand());
    System.out.println("South's hand: " + g.getSouth().getHand());
    Deal.setPreInitializedGame(g);
  }
View Full Code Here

Examples of org.gnubridge.core.Deal

    assertEquals("3 passes should follow 7NT bid", 4, auction.getCalls().size());
    assertTrue("Auction not complete even though highest bid was placed", auction.biddingFinished());
  }

  private void preInitializeGameWithHumanToBidFirst() {
    Deal g = new Deal(null);
    GameUtils.initializeRandom(g, TRICKS_PER_DEAL);
    g.setHumanPlayer(g.getWest());
    Deal.setPreInitializedGame(g);
  }
View Full Code Here

Examples of org.gnubridge.core.Deal

  }

  private void givenDeal() {
    if (deal == null) {
      deal = new Deal(NOTRUMP);
      solver = null;
    }

  }
View Full Code Here

Examples of org.gnubridge.core.Deal

import org.gnubridge.core.deck.Three;
import org.gnubridge.core.deck.Two;

public class DoubleDummySolverScenarioAcceptanceTest extends TestCase {
  public void test13cards3deep() {
    Deal game = new Deal(NoTrump.i());
    game.getPlayer(West.i()).init(King.of(Clubs.i()), King.of(Hearts.i()), Two.of(Diamonds.i()),
        Seven.of(Clubs.i()), Jack.of(Diamonds.i()), Eight.of(Clubs.i()), Four.of(Diamonds.i()),
        Ten.of(Hearts.i()), Three.of(Clubs.i()), Ten.of(Spades.i()), Eight.of(Hearts.i()), Five.of(Spades.i()),
        Ten.of(Diamonds.i()));
    game.getPlayer(North.i()).init(Four.of(Spades.i()), Ace.of(Clubs.i()), Five.of(Hearts.i()),
        Four.of(Hearts.i()), Nine.of(Spades.i()), Two.of(Spades.i()), Two.of(Hearts.i()), Nine.of(Clubs.i()),
        Jack.of(Clubs.i()), Nine.of(Diamonds.i()), Jack.of(Hearts.i()), Nine.of(Hearts.i()),
        Three.of(Spades.i()));
    game.getPlayer(East.i())
        .init(Two.of(Clubs.i()), Five.of(Clubs.i()), Queen.of(Clubs.i()), Three.of(Hearts.i()),
            Seven.of(Spades.i()), Seven.of(Hearts.i()), Seven.of(Diamonds.i()), Six.of(Clubs.i()),
            Eight.of(Spades.i()), Six.of(Hearts.i()), Jack.of(Spades.i()), Queen.of(Hearts.i()),
            Four.of(Clubs.i()));
    game.getPlayer(South.i()).init(Queen.of(Diamonds.i()), Five.of(Diamonds.i()), Queen.of(Spades.i()),
        Three.of(Diamonds.i()), King.of(Diamonds.i()), Ten.of(Clubs.i()), Six.of(Diamonds.i()),
        Ace.of(Diamonds.i()), Ace.of(Hearts.i()), Ace.of(Spades.i()), Eight.of(Diamonds.i()),
        King.of(Spades.i()), Six.of(Spades.i()));

    DoubleDummySolver pruned = new DoubleDummySolver(game);
View Full Code Here

Examples of org.gnubridge.core.Deal

  public void testEquivaltenceVariousPruneStrategies() {
    for (int cardDeal = 0; cardDeal < DEALS_TO_TRY; cardDeal++) {
      monkeys = new ArrayList<SearchMonkey>();
      Trump trump = determineTrump(cardDeal);
      g = new Deal(trump);
      GameUtils.initializeRandom(g, CARDS_TO_DEAL);
      System.out.println("*********** DEAL " + cardDeal + " ***********");
      g.playOneTrick(); //somewhat randomizes who's to move next
      g.printHands();
      g.printHandsDebug();
View Full Code Here

Examples of org.gnubridge.core.Deal

    int CARDS_TO_DEAL = 4;
    int DEALS_TO_TRY = 25;
    for (int cardDeal = 0; cardDeal < DEALS_TO_TRY; cardDeal++) {
      monkeys = new ArrayList<SearchMonkey>();
      Trump trump = determineTrump(cardDeal);
      g = new Deal(trump);
      GameUtils.initializeRandom(g, CARDS_TO_DEAL);
      System.out.println("*********** DEAL " + cardDeal + " ***********");
      g.playOneTrick(); //somewhat randomizes who's to move next
      g.printHands();
      g.printHandsDebug();
View Full Code Here

Examples of org.gnubridge.core.Deal

    Card secondMove = second.getBestMove();
    System.out.println("#####>  Search strategies " + first + " and " + second
        + " differ on what is the best move ( " + firstMove + " versus " + secondMove + "). "
        + "Now comparing tricks taken if each evaluates the other's best move.");

    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());
    int tricksTakenIfFirstMovePlayed = firstProxy.getNorthSouthTricks();

    Deal secondMovePlayed = originalGame.duplicate();
    secondMovePlayed.play(secondMove);
    firstProxy.runSearch(secondMovePlayed);
    secondProxy.runSearch(secondMovePlayed);
    assertEquals("played " + firstMove + " as recommended by " + secondProxy, firstProxy.getNorthSouthTricks(),
        secondProxy.getNorthSouthTricks());
    int tricksTakenIfSecondMovePlayed = firstProxy.getNorthSouthTricks();
View Full Code Here

Examples of org.gnubridge.core.Deal

    assertEquals(1, s.getBestMoves().size());
  }

  public void testIfCannotBeatPlayLowestToColorPruningNoConflictWithSequencePruning() {

    Deal game = new Deal(NoTrump.i());
    game.getPlayer(Direction.WEST_DEPRECATED).init(new Card[] { Ace.of(Spades.i()), Nine.of(Spades.i()) });
    game.getPlayer(Direction.NORTH_DEPRECATED).init(new Card[] { Five.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);
    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
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.