/**
*
*/
public void updateScore()
{
String str = "Score\tName\n";
for (int i=0; i<players.size(); i++)
{
str += ((Player) players.get(i)).toString() + "\n";
}
gui.setPlayersList(str);
}
2.
Write the documentation comments for the method below,
following the pseudocode standard.
/**
* Return an array of winners. It looks at all the scores, and gets
* the players
* with the highest score.
*
* @return an array of players representing the winners
*/
public Player[] getWinners()
{
Player player;
Vector winners = new Vector();
winners.add(players.get(0));
for (int i=1; i<players.size(); i++)
{
player = (Player) players.get(i);
if (player.getScore() > ((Player) winners.get(0)).getScore())
{
winners = new Vector();
winners.add(player);
}
else if (player.getScore() == ((Player) winners.get(0)).getScore())
{
winners.add(player);
}
}
Player wins[] = new Player[winners.size()];
winners.toArray(wins);
return wins;
}
WHILE deck is not empty
Assign card at start of the deck to each player
Decrement number of cards on the deck
END WHILE
Set each player's hand with distributed cards