Package a5

Class Main


public class Main extends Object
The main program for Assignment 5.
  • Field Details

    • WELCOME_MSG

      public static String WELCOME_MSG
      The message the program shows to welcome the player.
  • Constructor Details

    • Main

      public Main()
  • Method Details

    • main

      public static void main(String[] args)
      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

      public static void displayLine(String msg)
      Print out one message in one line.
      Parameters:
      msg - one message
    • gameSettingToStrings

      public static String gameSettingToStrings(GameType gameType, PlayerType p1, PlayerType p2)
      Returns: a string presenting the game setting.
      Parameters:
      gameType - type of the game
      p1 - type of the first player
      p2 - 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 player
      players - players of the game
    • endMessage

      public static String endMessage(GameResult result)
      Returns: a string presenting the game result.
      Parameters:
      result - result of the game