🥣How it works

The How

How It Works

  1. Command Input: A command (e.g., “Move Up One Step”) is given.

  2. State Transition: Robot status changes to moving.

  3. Movement: Position updates by one unit, within boundary rules.

  4. Battery Use: Battery decreases (e.g., −1 per move).

  5. State Reset: Returns to idle after completing or blocking a move.

  6. Collision Check: Invalid moves trigger a collision flag.

  7. Status Output: Updated status (position, battery, state, collision) is returned.


Rules & Constraints

  • Step Size: One command = one unit of movement.

  • Boundaries: Position must remain within defined X/Y limits.

  • Battery: Never below 0; no movement allowed when empty.

  • Collision: Invalid moves trigger a flag; behavior depends on chosen mode.

  • Extensibility: Robot size, abilities, and sensors can affect logic.


Example Status: { "position": [5,5], "battery": 3, "state": "idle", "collision": false } Command: “Move Right One Step”

  • state → moving

  • position → [6,5]

  • battery → 2

  • state → idle

  • collision → false

If the next command exceeds boundaries, position won’t update, collision = true, and status reflects that outcome.

Last updated