Пример #1
0
 private void setRank(Player p) // assigns ranks to each player as they finish
     {
   int counter = 0;
   if (p.getRank() != -10) // if the player already has a rank:
   return; // dont do anything
   for (Player x : players) // cont how many players are done
   {
     if (x.isDone()) counter++;
   }
   // sets rank based on how many players are done
   if (counter == 1) p.setRank(2); // prez
   else if (counter == 2) p.setRank(1); // vice
   else if (counter == players.size() - 1) p.setRank(-1); // vice scum
   else if (counter == players.size()) p.setRank(-2); // scum
   else p.setRank(0); // neutral
 }
Пример #2
0
  private void setupRound() // sets up each round right before game time
      {
    reset(); // resets and deals the card related variables
    skippedPlayers = 0; // resets the skipped players
    if (firstRound) // if this is the first round -- find the 3 of clubs holder
    {
      firstRound = false;
      currentPlayer = findThreeClubs();
    } else // if not -- trade the cards and set the first player as the president
    {
      trade(players.get(findPresident()), players.get(findScum()));
      trade(players.get(findPresident()), players.get(findScum()));
      trade(players.get(findVice()), players.get(findViceScum()));
      currentPlayer = findPresident();
      // System.out.println(players.get(currentPlayer));
    }

    /*
    for (Player p : players)
    {
        System.out.println(p);
        System.out.println();
    }
    */

    for (Player p : players) // reset the rank of each player
    {
      p.setRank(-10);
    }
  }