Package net.sf.nebulacards.main

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


    {
        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

    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

     * @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

    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

        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

          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

      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

TOP

Related Classes of net.sf.nebulacards.main.PlayingCard

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.