Code Guide - WolfgangKonen/GBG GitHub Wiki

Class Organization

After checking out the project, you'll have 8 folders:

  • src: the Java source code
  • lib: the Java libraries needed to run the game
  • test: the Java code for JUnit tests
  • doc: the Javadoc [NOTE: The doc directory is not part of the GitHub distribution. It will be created as soon as a Javadoc build is issued on the source code.]
  • agents: in directories [gameName] (and possible sub-dirs, if the game comes in different flavors, e.g. Hex) there are the stored agents. In sub-dirs csv there are result files from playing games (play*.csv) or from multi training (multiTrain*.csv).
  • logs: in directories [gameName] (and possible sub-dirs, if the game comes in different flavors, e.g. Hex) there are the stored game logs. [NOTE: The logs directory is not part of the GitHub distribution. It will be created as soon as the first game log is created.]
  • resources: help files (HTM,PDF), game rules (HTM,PDF), image files and technical report (PDF). In sub-dir R_plotTools there are some R-scripts for visualizing the results from the files in agents/[gameName]/csv.

NOTE: agents/2048/TDNT3-forGitHub.stub.agt.zip contains a sample TD-n-tuple agent stump (0.8 MB). This file is a stub, it has all parameter settings, but is not trained, because a trained agent would be too large to be stored on GitHub. After loading this agent, set Train Games to 200000 or 300000, train it (approx. 3h) and save it. The saved file .agt.zip will be 93 MB on disk.

Similarly, agents/ConnectFour/TCL-EXP-NT3-al37-lam000-6000k-epsfin0.stub.agt contains a stub for ConnectFour, which should be trained for 6 million episodes. The saved file will be 6 MB on disk.

The source code in src is organized in 9 packages:

  • agentIO: classes for loading and saving agents
  • controllers: the generic AI interface (PlayAgent, AgentBase) and all the built-in AI agents
  • games: all generic game classes and interfaces. In sub-dirs [gameName] there are the game-specific files and the game GUIs.
  • gui: classes related to the game GUI elements
  • ludiiInterface: classes related to an interface between Ludii and GBG (beta)
  • params: classes Par* with parameter settings, classes *Params with the corresponding GUIs
  • starters: classes GBGLaunch (start the main GBG-GUI) and GBGBatch (run GBG in batch mode)
  • tools: some auxiliary classes
  • TournamentSystem: classes needed to run tournaments

For an in-depth description of classes and interfaces in GBG see the technical report (PDF).