Examples of PlayingCard


Examples of net.sf.nebulacards.main.PlayingCard

  public void score(PileOfCards[] hands, Player[] p) {
    for (int i = 0; i < 4; i++) {
      int points = 0;
      points += hands[i].cardsInSuit(PlayingCard.HEARTS)
          .howManyCardsNotNull();
      if (hands[i].contains(new PlayingCard("Qs")))
        points += 13;
      // shot the moon?
      if (points == 26) {
        points = 0;
        for (int j = 0; j < 4; j++)
View Full Code Here

Examples of net.sf.nebulacards.main.PlayingCard

    {
        PileOfCards vp = new PileOfCards();
    Enumeration cards = h.elements();
    while (cards.hasMoreElements())
    {
      PlayingCard c = (PlayingCard)cards.nextElement();
            if (rules.validPlay( bp, t, h, c ))
      {
              vp.add( c );
      }
    }
View Full Code Here

Examples of net.sf.nebulacards.main.PlayingCard

    if (tableau.howManyCardsNotNull() == 0)
      tableau.setLead( position );
    Enumeration cards = vp.elements();
    while (cards.hasMoreElements())
    {
      PlayingCard c = (PlayingCard)cards.nextElement();
            tableau.set( position, c );
      if (rules.whoWinsTrick( tableau ) == position)
              results.add( c );
        }
        return results;
View Full Code Here

Examples of net.sf.nebulacards.main.PlayingCard

     * @param h The cards to examine.
     * @param aceHigh True if aces are higher than kings.
     */
    public static PlayingCard highCard( PileOfCards h, boolean aceHigh )
    {
        PlayingCard high = NullPlayingCard.getInstance();
    Enumeration cards = h.elements();
    while (cards.hasMoreElements())
    {
      PlayingCard c = (PlayingCard)cards.nextElement();
      if (higherThan( c, high, aceHigh ))
        high = c;
    }
        return high;
    }
View Full Code Here

Examples of net.sf.nebulacards.main.PlayingCard

    public static PlayingCard lowCard( PileOfCards h, boolean aceHigh )
    {
    Enumeration cards = h.elements();
    if (!cards.hasMoreElements())
      return NullPlayingCard.getInstance();
        PlayingCard low = (PlayingCard)cards.nextElement();
    while (cards.hasMoreElements())
    {
      PlayingCard c = (PlayingCard)cards.nextElement();
      if (higherThan( low, c, aceHigh ))
        low = c;
    }
        return low;
    }
View Full Code Here

Examples of net.sf.nebulacards.main.PlayingCard

        PileOfCards vp = validPlays( h, tableau, bp, rules );
        float f = 0;
    Enumeration tlCards = tl.elements();
    while (tlCards.hasMoreElements())
    {
            PlayingCard c = (PlayingCard)tlCards.nextElement();
            if (vp.contains(c))
                f += 2.0 / vp.howManyCardsNotNull();
            else
                f += 1.0;
        }
View Full Code Here

Examples of net.sf.nebulacards.main.PlayingCard

          delatch(incomingPlays, w);
          synchronized (coms[w]) {
            coms[w].clearResend();
            coms[w].yourTurn();
          }
          PlayingCard c = null;
          // loop until we get a valid play
          while (true) {
            // wait for play
            synchronized (this) {
              while (incomingPlays[w] == null) {
View Full Code Here

Examples of net.sf.nebulacards.main.PlayingCard

      PileOfCards tmp = new PileOfCards(beenPlayed);
      tmp.removeAll(tableau);
      coms[where].playedSoFar(tmp);
      // resend tableau
      for (int i = 0; i < 4; i++) {
        PlayingCard c = tableau.get(i);
        if (!c.isNull())
          coms[where].cardToTableau(i, c);
      }
      // resend bids
      for (int i = 0; i < m_game.getPlayers().length; i++) {
        if (m_game.getPlayers()[i].hasBid())
View Full Code Here

Examples of uk.co.iscoding.freecell.cards.PlayingCard

        if (cards.size() == 0) {
            if (startingRank != StartingRank.ANY && card.getRank() != startingRank.rank) return false;
            if (startingSuit != StartingSuit.ANY && card.getSuit() != startingSuit.suit) return false;
        } else {
            PlayingCard topCard = getTopCard();

            int rankDifference = card.rankDifference(topCard);
            if (cycleMode == Cycle.CAN && Math.abs(rankDifference) == 12) rankDifference += 13 * rankMode.factor;
            if (rankMode != RankOrder.ANY && rankDifference != rankMode.factor) return false;

View Full Code Here

Examples of uk.co.iscoding.freecell.cards.PlayingCard

        }

        if (numCards == 1) {
            clone.moveSequence.add(String.format("Move %s from %s to %s", from.getTopCard(), from, to));
        } else {
            PlayingCard topOfMovedPile = from.getTopCards(numCards).getBottomCard();
            if (numCards == 2) {
                clone.moveSequence.add(String.format("Move %s and 1 other card from %s to %s", topOfMovedPile, from, to));
            } else {
                clone.moveSequence.add(String.format("Move %s and %d other cards from %s to %s", topOfMovedPile, numCards - 1, from, to));
            }
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.