public static void main(String[] args) {
    String usage =
      "Usage: tacagent.jar [-options]\n"
      + "where options include:\n"
      + "    -config <configfile>      set the config file to use\n"
      + "    -agentimpl <className>    set the agent implementation\n"
      + "    -agent <agentname>        set the agent name\n"
      + "    -password <password>      set the agent password\n"
      + "    -host <host>              set the TAC Info Server host\n"
      + "    -port <port>              set the TAC Info Server port\n"
//       + "    -gameType <type>          set the game type to play\n"
      + "    -exitAfterGames <games>   set the number of games to play\n"
      + "    -connection <className>   set the TAC connection handler\n"
      + "    -consoleLogLevel <level>  set the console log level\n"
      + "    -fileLogLevel <level>     set the file log level\n"
      + "    -logPrefix <prefix>       set the prefix to log files\n"
      + "    -nogui                    do not show agent gui\n"
      + "    -h                        show this help message\n";
    ArgEnumerator a = new ArgEnumerator(args, usage, false);
    String configFile = a.getArgument("-config");
    if (configFile == null) {
      configFile = "agent.conf";
    }

    File configFP = new File(configFile);
    Properties config = getConfig(configFile, configFP);
    if (config == null) {
      config = new Properties();
    }

    // Use the Master agent rather than the dummy agent
    String agentClass = "se.sics.tac.agent.MasterAgent";

    // Try to create the agent
    AgentImpl agent;
    try {
      agent = (AgentImpl) Class.forName(agentClass).newInstance();
    } catch (Exception e) {
      log.log(Level.SEVERE, "could not create AgentImpl object of class "
	      + agentClass, e);
      new TACAgent(null).fatalError("no agent implementation available");
      return;
    }

    // Add the agents own arguments
    usage = agent.getUsage();
    if (usage != null) {
      a.setUsage(a.getUsage() + "\nOptions for agent implementation "
		 + agentClass + '\n' + usage + '\n');
    }
    a.checkHelp();

    boolean gui =
      !(a.hasArgument("-nogui")
	|| "true".equals(config.getProperty("nogui", null)));

    TACAgent agentWare = new TACAgent(agent, a, config);
    if (gui) {
      agentWare.showGUI();
    }
    // Allow garbage usage
    usage = null;
    a = null;
    configFP = null;
    config = null;
  }