com.anji.tournament
Class IteratedGame

java.lang.Object
  extended by com.anji.tournament.IteratedGame
All Implemented Interfaces:
Game, Configurable

public class IteratedGame
extends java.lang.Object
implements Game, Configurable

This is a game composed of iterating over a component game. This is an abstract object that can represent, for example, a match, set, or game of multiple trials. Every other component game swaps the order of the contestant and opponent (or, player one and player two) to give both players a chance to move first in games where initiative matters.

Author:
Philip Tucker

Constructor Summary
IteratedGame()
          default ctor; should call init() after this
IteratedGame(Game aComponentGame, int anIterationCount)
           
IteratedGame(Game aComponentGame, int anIterationCount, GameConfiguration aConfig)
           
 
Method Summary
 int getMaxScore(ScoringWeights aWeights)
           
 int getMinScore(ScoringWeights aWeights)
           
 void init(Properties props)
           
 GameResults play(PlayerResults contestantResults, PlayerResults opponentResults)
           
 java.lang.Class requiredPlayerClass()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratedGame

public IteratedGame()
default ctor; should call init() after this


IteratedGame

public IteratedGame(Game aComponentGame,
                    int anIterationCount)
Parameters:
aComponentGame -
anIterationCount -

IteratedGame

public IteratedGame(Game aComponentGame,
                    int anIterationCount,
                    GameConfiguration aConfig)
Parameters:
aComponentGame -
anIterationCount -
aConfig -
Method Detail

play

public GameResults play(PlayerResults contestantResults,
                        PlayerResults opponentResults)
Specified by:
play in interface Game
Returns:
GameResults for this game only; these totals are also added to each players results
See Also:
Game.play(com.anji.tournament.PlayerResults, com.anji.tournament.PlayerResults)

requiredPlayerClass

public java.lang.Class requiredPlayerClass()
Specified by:
requiredPlayerClass in interface Game
Returns:
class of which all players must be subclass (or implementor, if interface); must be implementor of Player
See Also:
Game.requiredPlayerClass()

getMaxScore

public int getMaxScore(ScoringWeights aWeights)
Specified by:
getMaxScore in interface Game
Returns:
maximum possible score for a single game, given these scoring weights
See Also:
Game.getMaxScore(com.anji.tournament.ScoringWeights)

getMinScore

public int getMinScore(ScoringWeights aWeights)
Specified by:
getMinScore in interface Game
Returns:
minimum possible score for a single game game, given these scoring weights
See Also:
Game.getMinScore(com.anji.tournament.ScoringWeights)

init

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