Class Main

Object
Main

public class Main extends Object
Main driver class for the Game. The game has a number of program arguments, with only two that are **required** to function.
  • --data={data filename}
    data file needed for the game, contains MOBs and Fortunes
  • {save filename}
    save file needed for the game, contains knights
Both are optional, as they have default values.

Examples:

     java Main 
     java Main knights.csv
     java Main --data=data/gamedata.csv
     java Main --data=gamedata2.csv mygame.csv
 
  • Constructor Details

    • Main

      public Main()
  • Method Details

    • main

      public static void main(String[] args)
      Takes in command line parameters, looks through the program arguments. Builds the objects to run the game, and passes control over to the GameController. Example code includes
           parseArgs(args); // method that parses the args
           GameData data = new CSVGameData(gamedata, saveData);
           GameView view  = new ConsoleView();
           CombatEngine engine = new CombatEngine(data, view);
           GameController controller = new GameController(data, view, engine);
           controller.start();
       
      Remember, P4 where you looped through the args[] array looking to process the arguments? You will be doing something very similar here in this method (or in our case, a private method we created called parseArgs(args))
      Parameters:
      args - the command line arguments option