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(); } }
private void startFirstVote() { try { ArrayList<Candidate> candidates = model.getCandidates(); player.setRound("first"); writeMessage(10, candidates.size()); out.writeByte(0); int numPlayers = model.getNumPlayers(); for (Candidate candidate : candidates) { out.writeByte(candidate.getCandidateNumber()); int numVotes = candidate.getStrawVotes(); int percentVotes = ((numVotes * 100) / numPlayers); out.writeInt(percentVotes); } } catch (IOException e) { removePlayer(); } }