Examples of Trick


Examples of com.svanloon.game.wizard.stats.Trick

  }

  private TrickTracker playTrick(Card trump, int lead, Round round) {
    gameEventNotifier.notify(new NewTrickEvent());
    round.newTrick();
    Trick trick = round.getCurrentTrick();
    TrickTracker trickTracker = new TrickTracker(trump);
    for (Player player: new PlayerIterator(_playerCollection, lead)) {
      Card card = null;
      for (boolean isValid = false; isValid == false;) {
        // need to make sure the card is valid. otherwise repeat
        gameEventNotifier.notify(new PlayerNeedsToPlay(player.getId()));
        card = player.playCard();
        if (ValidityChecker.checkValidity(trickTracker, trump, card, player)) {
          isValid = true;
          gameEventNotifier.notify(new PlayerPlayedEvent(player.getId(), card));
          player.playCardIsValid(card);
        } else {
          player.playCardIsNotValid(card);
        }
      }
      trickTracker.addCardPlayed(player.getId(), card);
      trick.add(new Play(player.getId(), card));
      if (card != null && card.isWizard()) {
        trick.setWizardPlayed(true);
      }
    }
    int winnerId = trickTracker.winningPlay().getPlayerId();
    Card winningCard = trickTracker.winningPlay().getCard();
    trick.setWinner(winnerId);
    gameEventNotifier.notify(new PlayerWonTrickEvent(winnerId, winningCard));

    return trickTracker;
  }
View Full Code Here

Examples of org.gnubridge.core.Trick

  public void printOptimalPath(Deal g) {
    Node move = getBestMove();
    if (move == this) {
      for (int moveIdx : getMoves()) {
        Trick currentTrick = g.getCurrentTrick();
        System.out.println(g.getNextToPlay() + ": "
            + g.getNextToPlay().getPossibleMoves(currentTrick).get(moveIdx));
        g.doNextCard(moveIdx);
        if (currentTrick.isDone()) {
          System.out.println("  Trick taken by " + g.getPlayer(g.getWinnerIndex(currentTrick)));
        }
      }
    } else {
      move.printOptimalPath(g);
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.