Menu

Mazes

Mazes

The framework will automatically play all mazes that are stored inside the directory data/maze. It will keep cycling through the various mazes, unless eternalGame has been disabled in Globals.java. See [Configuration] on instructions how to setup Globals.java to play each maze only once. The data format for mazes is the following:

  1. The file should start with this:
    [maze]
  • Then, on a new line, state the width and height of the maze separated by a comma. Such as:
    5,7
  • Now comes the actual content of the maze. Use the following numbers to denote an object, agent or point. In this example, the framework will expect 7 lines containing 5 comma-separated numbers.

    Value Object, Agent or Point
    0 Empty space
    1 Wall
    2 Pill
    3 Power Pill
    4 Pac-Man Spawn Point
    7 Ghost First Stop (ghosts will start each maze by traveling to this point)
    8 Ghost Spawn Area (Ms. Pac-Man will not be allowed to enter this area)
    9 Ghost Spawn Point

For example:

    1,1,1,1,1
    1,8,9,8,1
    1,1,8,1,1
    1,2,7,2,1
    0,2,1,2,0
    1,0,4,0,1
    1,1,1,1,1

Note how positions 0,4 and 4,4 are on the outer edge of the maze and still contain an empty space. As these points share the same vertical position (y=4), the framework will convert them to warp tunnels. Agents can use these to teleport themselves from one side of the maze to the other.

  • Next, information needs to be provided regarding the ghosts.
    Add the following line:
    [Ghost]
  • State the amount of ghosts on a new line. Such as:
    4
  • Now, for each ghost, state its speed relative to Ms. Pac-Man. Like so:
    0.85
    0.80
    0.80
    0.70
  • Add the following line:
    [Scatter]
  • To conclude, we need to state the points which are considered the corners of the maze. These points must not contain a wall and be reachable by all agents, as ghosts will use them as their destination during SCATTER. State the x,y-positions on separate lines. Note that the top left position is 0,0 (and not 1,1). For this example, one might set the maze corners like this:
    1,3
    3,3
    1,5
    3,5

Related

Documentation: Configuration

Auth0 Logo