com.anji.tournament
Class SingleEliminationTournament

java.lang.Object
  extended by com.anji.tournament.SingleEliminationTournament
All Implemented Interfaces:
Tournament, Configurable

public class SingleEliminationTournament
extends java.lang.Object
implements Tournament, Configurable

Standard double elimination tournament, except players are re-seeded after every round. Also, in final round if losers bracket champ beats winners bracket champ, another game is played to determine champ.

Author:
Philip Tucker

Constructor Summary
SingleEliminationTournament()
          default ctor; init() should be called before using this object
SingleEliminationTournament(Game aGame, ScoringWeights aWeights, java.util.Random aRand)
          ctor Note: this object overrides aMatch countOpponentResults to true
 
Method Summary
 void addContestant(Player aContestant)
           
 void clearContestants()
          remove all contestants added via addContestant()
 int getMaxRounds()
          This isn't precise, but should be greater than or equal to the number of rounds.
 int getMaxScore()
          Sum of round scores, which start at contestants.size() and double each round
 int getMinScore()
           
 void init(Properties props)
          Note: this object overrides aMatch countOpponentResults to true
 java.util.List playTournament()
          Play full tournament.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleEliminationTournament

public SingleEliminationTournament()
default ctor; init() should be called before using this object


SingleEliminationTournament

public SingleEliminationTournament(Game aGame,
                                   ScoringWeights aWeights,
                                   java.util.Random aRand)
ctor Note: this object overrides aMatch countOpponentResults to true

Parameters:
aGame -
aWeights -
aRand -
Method Detail

clearContestants

public void clearContestants()
Description copied from interface: Tournament
remove all contestants added via addContestant()

Specified by:
clearContestants in interface Tournament
See Also:
Tournament.clearContestants()

addContestant

public void addContestant(Player aContestant)
Specified by:
addContestant in interface Tournament
Parameters:
aContestant - Player to be added.
See Also:
Tournament.addContestant(com.anji.tournament.Player)

playTournament

public java.util.List playTournament()
Description copied from interface: Tournament
Play full tournament.

Specified by:
playTournament in interface Tournament
Returns:
List contains TournamentPlayerResults objects, sorted in descending order of score
See Also:
Tournament.playTournament()

getMaxRounds

public int getMaxRounds()
This isn't precise, but should be greater than or equal to the number of rounds.

Returns:
number of rounds in tournament; the extra game played at the end if the winners bracket champ loses to the losers baracket champ is not considered a separate round

getMaxScore

public int getMaxScore()
Sum of round scores, which start at contestants.size() and double each round

Specified by:
getMaxScore in interface Tournament
Returns:
maximum possible score a contestant can achieve in this tournament; this value may change as contestants are added; refers to TournamentPlayerResults.getTournamentScore() not TournamentPlayerResults.getScore()
See Also:
Tournament.getMaxScore()

getMinScore

public int getMinScore()
Specified by:
getMinScore in interface Tournament
Returns:
minimum possible score a contestant can achieve in this tournament; this value may change as contestants are added; refers to TournamentPlayerResults.getTournamentScore() not TournamentPlayerResults.getScore()
See Also:
Tournament.getMinScore()

init

public void init(Properties props)
          throws java.lang.Exception
Note: this object overrides aMatch countOpponentResults to true

Specified by:
init in interface Configurable
Parameters:
props - configuration parameters
Throws:
java.lang.Exception
See Also:
Configurable.init(com.anji.util.Properties)