Time Factory

The idea for this puzzle type game is that you program a robot that moves around a level and interact with objects, one of which is a time machine, turning time backwards. When this happens, the level is replaced by what it was before, except the robot using the time machine replaces what was there before. The player prechooses all the moves the robot makes, one after another. There are three move types (there could be more):


 * Point in a direction: this is a front-view game so the directions are left, right, up and down.
 * Walk: move one square in the direction the robot is facing.


 * Activate (n): activate whatever is on the same tile as the robot. This includes buttons, levers, and time machines. When adding this move, you must specify a number n: this details how many moves backward the time machine will make if that's the activated object. In the case of a button or lever, the number has no effect.

Example
Here's an example of a level: In this level, the robot begins on the top left of the level and the objective is to reach the flag on the bottom right. To do this, the solution is:

Point right, walk, walk, activate 3, walk, activate 1, walk

This is how it works:


 * Point right: the robot points right.
 * Walk: the robot walks right one square because that is the direction it's facing. It's now on the tile with an opening floor (currently closed).
 * Walk: the robot walks right to the square with a time machine.
 * Activate 3: the robot activates the time machine 3 times, meaning it travels back 3 turns to the time when the robot hadn't pointed right yet. Now, there are two robots, the one on the top left from the past and the current one at the time machine.
 * Walk: the robot walks right to the tile with a button. At the same time, the other robot performs its first action: point right.
 * Activate 1: the robot presses the button (the number is irrelevant here), opening the corresponding opening floor. At the same time, the other robot has walked to the right, falling through the opening floor, and landing on the tile marked empty.
 * Walk: the robot walks to the right on top of the second opening floor. At the same time, the other robot walks right as well to the tile with the corresponding second button.
 * Nothing: the robot has no actions left, so it stays on the opening floor. The other robot has the action 'Activate 3.' The number is irrelevant here. It presses the button, opening the opening floor, making the first robot fall and collect the flag. Mission complete!

This is probably a bit hard to understand, and I'm trying to look for some visuals to explain this better.

Elements
Every level consists of several elements, each one occupying one tile. These elements can be linked together in certain ways.


 * Button: linked to an output element. When activated, activates that element for one turn.
 * Lever: linked to an output element. When activated, if n is odd, toggles the state of the output element between activated and not activated.
 * Time machine: when activated, returns the level state to what it was n turns before, except the robot activating the time machine replaces whatever was there before (if anything).
 * Opening floor: linked to an input element. When activated, opens the floor, allowing all objects on it to fall below.
 * Flag: when touched by a robot, signifies the success of the level.

Robots
There are different robots that behave differently and have different abilities.


 * Basic robot: can perform the basic actions of pointing in a direction, walking, activating on the same tile and waiting, but not jumping. The basic robot cannot walk while falling.
 * Archer robot: can activate a tile from up to 3 tiles away by firing an arrow. Limited number of shots.
 * Extendable arm robot: can activate a tile from 1 tile away.