Package threeChess
Class ThreeChess
- java.lang.Object
-
- threeChess.ThreeChess
-
public class ThreeChess extends java.lang.Object
Class with static methods for running tournaments and playing threeChess matches.
-
-
Constructor Summary
Constructors Constructor Description ThreeChess()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
This method can be customised to run tournaments with agents added in the code (add them to array bots), or manual games between players, or a cheat mode which is effectively a board that can be freely manipulated.static void
play()
Default play scenario for three manual agents, no time limit, logged to System.out with display on.static int[]
play(Agent blue, Agent green, Agent red)
Runs a timed threeChess game between three players with a graphical board and moves logged to System.out.static int[]
play(Agent blue, Agent green, Agent red, int timeLimit, java.io.PrintStream logger, boolean displayOn)
Runs a threeChess game between three players.static void
playCheat()
This plays amanual game where all rules are ignored.static void
tournament(Agent[] bots, int timeLimit, int numGames, java.lang.Boolean displayOn, java.lang.String logFile)
Runs a tournament for a group of agents.
-
-
-
Method Detail
-
tournament
public static void tournament(Agent[] bots, int timeLimit, int numGames, java.lang.Boolean displayOn, java.lang.String logFile)
Runs a tournament for a group of agents. The games in the tournament will have the specified time limit. If a non-zero number of games are specified, the agents will be randomly assigned to games. If 0 is specified, every agent will play every other pair of agents, with the colours of the pieces randomly assigned.- Parameters:
bots
- an array of Agents to compete in the contest.timeLimit
- the cumulative time each player has (in seconds). To specify an untimed game, set as less than or equal to zero.displayOn
- a boolean flag for whether the game should be graphically displayedlogFile
- a FileName to print the game logs to. If this can't be found, or is null, System.out will be used instead.
-
play
public static int[] play(Agent blue, Agent green, Agent red, int timeLimit, java.io.PrintStream logger, boolean displayOn)
Runs a threeChess game between three players. There are options to display the board, and log the game to a text file. A time limit may also be specified for a timed game.- Parameters:
blue
- the agent playing the blue pieces.green
- the agent playing the green pieces.red
- the Agent playing the red pieces.timeLimit
- the cumulative time each player has (in seconds). To specify an untimed game, set as less than or equal to zero.logger
- a printStream to write the game moves to.displayOn
- a boolean flag for whether the game should be graphically displayed- Returns:
- an array of three ints, the scores for blue, green and red, in that order.
-
play
public static int[] play(Agent blue, Agent green, Agent red)
Runs a timed threeChess game between three players with a graphical board and moves logged to System.out.- Parameters:
blue
- the agent playing the blue pieces.green
- the agent playing the green pieces.red
- the agent playing the red pieces.- Returns:
- an array of three ints, the scores for blue, green and red, in that order.
-
play
public static void play()
Default play scenario for three manual agents, no time limit, logged to System.out with display on.
-
playCheat
public static void playCheat()
This plays amanual game where all rules are ignored. This effectively allows you to move pieces around the board for simulating positions.
-
main
public static void main(java.lang.String[] args)
This method can be customised to run tournaments with agents added in the code (add them to array bots), or manual games between players, or a cheat mode which is effectively a board that can be freely manipulated. Run program with parameter "manual" for a game with moves added in the command line, "cheat" to ignore all rules, and no parameters to run a tournament between agents listed in bots.
-
-