Oh crap, it actually works

This page has been adapted from the original blog post.

Simulation Parameters

The default simulation parameters are based off of the original(ish) Scratch program. (This actually includes my implementation of the Mark II AI instead of the default, but the specifications are the same).

Many of these parameters can be easily modified. For example, the power cost of each action (other than sense) can be increased or decreased. The dimensions of the level can also be adjusted.


The surface of mars is represented by a 32x23 tile grid with 5 different terrain types:

The terrain is generated randomly. A border of impassible tiles is created first. Each inner tile has a 10% chance of being impassable, a 30% chance of being rough, and a 60% chance of being smooth. The center tile where the rover starts is always smooth.

Rover terrain in Scratch


The rover starts off with 500 power and 1000 moves. It can perform several different actions:

ActionPower CostMoves UsedDescription
Sense00Senses the type of terrain on an adjacent tile
Move (Smooth)101Moves the rover in a cardinal direction
Move (Rough)501Moves the rover in a cardinal direction
Collect Sample101Collects a sample from the tile the rover occupies and turns it into a sampled tile
Process Samples301Processes up to 3 collected samples in the hopper
Transmit Samples501Transmits all processed samples
Collect Power01Adds power to the rover equal to No Backtrack3 (detailed below)

NoBacktrack counts the number of consecutive moves onto smooth terrain. This is reset whenever the rover collects light or moves onto a tile that is not smooth terrain. This number is cubed to determine the amount of power to add to the rover.



An AI is allowed to use any of the above actions to control the rover, but nothing else (no cheating). The goal is to transmit the most amount of processed samples before the rover runs out of power or moves. I think getting an 'A' required transmitting at least 150 samples (or maybe it was 200).

A rover needs about 2.1 moves for each sample including processing every 3 samples (1 sample + 1 move + 1/3 process). A rover will need to collect power at least once and transmitt once, so that leaves 998 moves left. Therefore, in the perfect simulation, the rover will transmit 427 samples. Since on average there will be (32 - 2) / (23 - 2) * .9 = 567 tiles that can be sampled on each map, it's impossible for a rover to collect samples from every tile on the map.