public class Controller extends java.lang.Object implements SwitchListener, java.lang.Runnable
Constructor and Description |
---|
Controller()
constructs and shows main window and the minimum agenda
|
Modifier and Type | Method and Description |
---|---|
void |
controlRobot()
opens a window that allows a direct robot arm control - can be used for finding the robot arm angles of individual positions on the field
|
java.lang.String[] |
getGameNames()
should return the list of available games, this should probably go to some external file (?)
|
java.lang.String[] |
getHeuristicsForGame(java.lang.String strategyName)
returns list of heuristics that are compatible with the specified strategy - also a place for improvement
|
java.lang.String[] |
getLearnableStrategyTypesForGame(java.lang.String gameName)
returns a list of strategies that can learn to play the specified game - improve...?
|
int |
getNumberOfPlayersForGame(java.lang.String gameName)
return the number of players for the specified game - should read the specs...fixit!
|
java.lang.String[] |
getStrategiesForGame(java.lang.String gameName)
returns list of strategies that can play the specified game, we should improve this architecture somehow later
|
int |
learn(java.lang.String gameName,
Player.boardType boardType,
Player.playerType[] playerTypes,
java.lang.String[] playerStrategies,
java.lang.String[] strategyHeuristics,
java.lang.String learnStrategyType,
java.lang.String strategyFileName,
int numberOfRuns)
tries to learn to play a game - not yet in use
|
void |
play(java.lang.String gameName,
Player.boardType boardType,
Player.playerType[] playerTypes,
java.lang.String[] playerStrategies,
java.lang.String[] strategyHeuristics,
int numberOfRuns)
starts a single game
|
void |
run()
a controller thread that plays all the games in this round - usually just one
|
void |
switchChanged(boolean newState)
called automatically when a game starts or stops
|
public Controller()
public void switchChanged(boolean newState)
switchChanged
in interface SwitchListener
public java.lang.String[] getGameNames()
public java.lang.String[] getStrategiesForGame(java.lang.String gameName)
public java.lang.String[] getHeuristicsForGame(java.lang.String strategyName)
public java.lang.String[] getLearnableStrategyTypesForGame(java.lang.String gameName)
public int getNumberOfPlayersForGame(java.lang.String gameName)
public void play(java.lang.String gameName, Player.boardType boardType, Player.playerType[] playerTypes, java.lang.String[] playerStrategies, java.lang.String[] strategyHeuristics, int numberOfRuns)
gameName
- name of the game to playboardType
- real or simulatedplayerTypes
- for each player whether it is a human or a computerplayerStrategies
- only for computer players, name of strategy to usestrategyHeuristics
- name of heuristic to use for each computer playernumberOfRuns
- how many times to play this game (normally 1, but higher when running statistical runs)public void run()
run
in interface java.lang.Runnable
public int learn(java.lang.String gameName, Player.boardType boardType, Player.playerType[] playerTypes, java.lang.String[] playerStrategies, java.lang.String[] strategyHeuristics, java.lang.String learnStrategyType, java.lang.String strategyFileName, int numberOfRuns)
gameName
- name of the game to playboardType
- real or simulatedplayerTypes
- for each player whether it is a human or a computerplayerStrategies
- only for computer players, name of strategy to usestrategyHeuristics
- name of heuristic to use for computer playersstrategyFileName
- where should we save the learned strategynumberOfRuns
- how many times to play the game while learninglearnStrategyType
- strategy that will be learnedpublic void controlRobot()