Logo Search packages:      
Sourcecode: filler version File versions  Download package

int [] friendless::games::filler::FillerPanel::tournamentMatch ( PlayerWrapper[]  players  )  [inline]

Play a tournament match between the given pair of players.

Returns:
the scores of the players in the same order as they are in players. This method sets up the combo boxes before the game, and displays the victory details afterwards.

Definition at line 249 of file FillerPanel.java.

References friendless::games::filler::PlayerWrapper::getName(), and playerNames.

Referenced by friendless::games::filler::Tournaments::playBashoMatches(), and friendless::games::filler::Tournaments::playTournamentMatches().

                                                          {
        if (players[0] == null) {
            return new int[] { -1, 0 };
        } else if (players[1] == null) {
            return new int[] { 0, -1 };
        }
        playerNames[0].setSelectedItem(players[0]);
        playerNames[1].setSelectedItem(players[1]);
        playerNames[0].repaint();
        playerNames[1].repaint();
        int[] scores = play(players);
        int winner = (scores[0] > scores[1]) ? 0 : 1;
        int loser = 1 - winner;
        String h2h = resources.getString("filler.string.h2h") + ": " + PlayerRatings.getHeadToHead(players);
        String mesg = resources.getString("filler.string.winner");
        mesg = MessageFormat.format(mesg,  new Object[] { players[winner].getName() });
        showMessage(mesg, h2h);
        String template = resources.getString("filler.string.matchresult");
        Object[] args = { players[winner].getName(), players[loser].getName(),
            new Integer(scores[winner]), new Integer(scores[loser]) };
        mesg = MessageFormat.format(template, args);
        TournamentResultsPanel.getInstance(resources).addText(mesg + SEP);
        PlayerRatings.save();
        return scores;
    }


Generated by  Doxygen 1.6.0   Back to index