Package net.sf.nebulacards.main

Examples of net.sf.nebulacards.main.PassingRules


  private void conductPassing() throws IOException, InterruptedException {
    int[] howmany = new int[4], where = new int[4];
    PileOfCards[] pass = new PileOfCards[4];
    boolean[] done = new boolean[4];
    PassingRules pm_game = (PassingRules) m_game;
    for (int i = 0; i < 4; i++) {
      if ((howmany[i] = pm_game.numPass(i)) > 0) {
        where[i] = pm_game.wherePass(i);
        done[i] = false;
        delatch(incomingPasses, i); // clean up input area
        synchronized (coms[i]) {
          coms[i].clearResend();
          coms[i].yourTurnToPass(howmany[i], where[i]);
        }
      } else
        done[i] = true;
    }
    while (!(done[0] && done[1] && done[2] && done[3])) {
      synchronized (this) {
        if (allNull(incomingPasses))
          wait(1000);
      }
      for (int i = 0; i < 4; i++) {
        pass[i] = (PileOfCards) delatch(incomingPasses, i);
        if (pass[i] != null) {
          if (pass[i].howManyCardsNotNull() == howmany[i]) {
            done[i] = true;
            for (int j = 0; j < pass[i].size(); j++) {
              if (!m_game.getHands()[i].contains(pass[i].get(j)))
                done[i] = false;
            }
            if (done[i])
              done[i] = pm_game.checkPass(i, pass[i]);
          }
          if (!done[i]) { // illegal pass, have to ask again
            synchronized (coms[i]) {
              coms[i].clearResend();
              coms[i].yourTurnToPass(howmany[i], where[i]);
View Full Code Here

TOP

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

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.