Package com.codingame.gameengine.runner
Class SoloGameRunner
java.lang.Object
com.codingame.gameengine.runner.SoloGameRunner
The class to use to run local games and display the replay in a webpage on a temporary local server.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionOnce this runner is instantiated, the system property game.mode is set to "solo" -
Method Summary
Modifier and TypeMethodDescriptionprotected void
buildInitCommand
(com.codingame.gameengine.runner.Command initCommand) void
Sets an AI to the next game to run.void
Sets an AI to the next game to run.void
Sets an AI to the next game to run.void
Sets an AI to the next game to run.void
setTestCase
(File testCaseFile) Sets a test case file which testIn value will be sent to the Game Manager as a test case input.void
setTestCase
(String testCaseFileName) Sets a test case file by file path which testIn value will be sent to the Game Manager as a test case input.void
setTestCaseInput
(String testCaseInput) Sets aString
as a test case input that will be sent to the Game Manager.void
setTestCaseInput
(List<String> testCaseInput) Sets a list ofString
as a test case input that will be sent to the Game Manager.simulate()
Runs the game without a server and returns computed game resultsvoid
start()
Runs the game and attempts to start a server on the port 8888.void
start
(int port) Runs the game and attempts to start a server on the given port.
-
Field Details
-
log
protected static org.apache.commons.logging.Log log -
players
-
-
Constructor Details
-
SoloGameRunner
public SoloGameRunner()Once this runner is instantiated, the system property game.mode is set to "solo"
-
-
Method Details
-
setTestCase
Sets a test case file by file path which testIn value will be sent to the Game Manager as a test case input.The file path must be relative considering the root directory is config.
- Parameters:
testCaseFileName
- the test case file path (JSON or YAML)
-
setTestCase
Sets a test case file which testIn value will be sent to the Game Manager as a test case input.- Parameters:
testCaseFile
- the test case file (JSON or YAML)
-
setTestCaseInput
Sets a list ofString
as a test case input that will be sent to the Game Manager.- Parameters:
testCaseInput
- the list ofString
of the test case input
-
setTestCaseInput
Sets aString
as a test case input that will be sent to the Game Manager.The input will be split in several lines by \n.
- Parameters:
testCaseInput
- theString
of the test case input
-
setAgent
Sets an AI to the next game to run.- Parameters:
playerClass
- the Java class of an AI for your game.
-
setAgent
Sets an AI to the next game to run.The given command will be executed with
Runtime.getRuntime().exec()
.- Parameters:
commandLine
- the system command line to run the AI.
-
setAgent
Sets an AI to the next game to run.- Parameters:
playerClass
- the Java class of an AI for your game.nickname
- the player's nicknameavatarUrl
- the url of the player's avatar
-
setAgent
Sets an AI to the next game to run.The given command will be executed with
Runtime.getRuntime().exec()
.- Parameters:
commandLine
- the system command line to run the AI.nickname
- the player's nicknameavatarUrl
- the url of the player's avatar
-
buildInitCommand
protected void buildInitCommand(com.codingame.gameengine.runner.Command initCommand) -
start
public void start()Runs the game and attempts to start a server on the port 8888.Open a webpage to the server to watch the game's replay.
-
start
public void start(int port) Runs the game and attempts to start a server on the given port.Open a webpage to the server to watch the game's replay.
- Parameters:
port
- the port on which to attempt to start the a server for the game's replay.
-
simulate
Runs the game without a server and returns computed game results- Returns:
- game result of the game
-