Package a5
Class Main
java.lang.Object
a5.Main
The main program for Assignment 5.
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
The message the program shows to welcome the player. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
currentPlayerToString
(PlayerRole currentPlayer, Map<PlayerRole, Player> players) Returns: a string presenting the current player.static void
displayLine
(String msg) Print out one message in one line.static String
endMessage
(GameResult result) Returns: a string presenting the game result.static String
gameSettingToStrings
(GameType gameType, PlayerType p1, PlayerType p2) Returns: a string presenting the game setting.static void
The main method to run a game.
-
Field Details
-
WELCOME_MSG
The message the program shows to welcome the player.
-
-
Constructor Details
-
Main
public Main()
-
-
Method Details
-
main
The main method to run a game.- Parameters:
args
- args must contain at least these three arguments: game type, type of the first player (AI or human), type of the second players (AI or human). Three options can be specified before them: "--showinfo" enable printing out info for minimax search) "--timelimit n" set time limit for AI players to n ms "--help" show usage help
-
displayLine
Print out one message in one line.- Parameters:
msg
- one message
-
gameSettingToStrings
Returns: a string presenting the game setting.- Parameters:
gameType
- type of the gamep1
- type of the first playerp2
- type of the second player
-
currentPlayerToString
public static String currentPlayerToString(PlayerRole currentPlayer, Map<PlayerRole, Player> players) Returns: a string presenting the current player.- Parameters:
currentPlayer
- role of the current playerplayers
- players of the game
-
endMessage
Returns: a string presenting the game result.- Parameters:
result
- result of the game
-