示例#1
0
 private void startSecondBuy() {
   try {
     ArrayList<Candidate> candidates = model.getSortedCandidates();
     writeMessage(10, candidates.size());
     out.writeByte(1);
     int numPlayers = model.getNumPlayers();
     for (Candidate candidate : candidates) { // This writes the top candidates
       out.writeByte(candidate.getCandidateNumber());
       int numVotes = candidate.getFirstVotes();
       int percentVotes = ((numVotes * 100) / numPlayers);
       out.writeInt(percentVotes);
     }
   } catch (IOException e) {
     removePlayer();
   }
 }