# Infinite Mario

Originally from 2009.rl-competition.org/mario.php, which should be used if possible.

### Actions

The action integers are an array of length 3: {[-1,1], [0,1], [0,1]}. They correspond with the buttons on a Ninendo controller, {direction pad, A, B}

• The first refers to the direction Mario is heading, with -1 for left, 0 for neither and 1 for right.
• The second refers to not jumping (0) or jumping (1).
• The third refers to the speed button being off (0) or on (1).

### Observations

The state space has no set specification, as its intArray and doubleArray sizes can grow depending on how many monsters are visible at any given time. The charArray is a constant size, representing the layout of the visible tiles.

intArray[0] is the x coordinate of the left-most visible tile, used to align the tiles represented in the charArray to the world.

For every monster, two values are appended to the intArray and 4 values are appended to the doubleArray. The values appended to the intArray are [type, winged]. The values appended to the double array are [x, y, x speed, y speed].

x and y are aligned with the tiles, but can have in-between values. x and y speed are in tiles per step.

The monster types are:

• 0: Mario
• 1: Red Koopa
• 3: Goomba
• 4: Spikey
• 5: Piranha Plant
• 6: Mushroom
• 7: Fire Flower
• 8: Fireball (tossed by Mario)

If an enemy is winged, it bounces.

The charArray is a set of 16 rows separated by carriage returns, each with 21 chars. Thus, there are 16*(21+1)=352 elements in the charArray. Each element represents a tile in the game. The row a tile appears in determines its y position, the last row being y=0, and y increasing as the row number decreases. The x position is determined by the column + the offset found in intArray[0]. If the charArray is printed to a terminal, it will look like the game, without the monsters.

The tiles can be any of the following:

• 0-7: a bit vector where the first bit indicates whether an entity can pass through this time from the top, the second bit for passing through from the bottom, and the third bit for passing through from either side. 0 if can pass, 1 if can't pass
• b: a brick
• ?: a question-block that mario can slam his head into to get something out of
• \$: a coin
• |: a pipe. Different than 7 because piranha plants often come out of pipes
• !: the finish line
• M: the tile that mario is standing on

Tiles with x position < 0 are considered always solid.