AiLearn AI Coding
mediumOpen-ended · your tools45 min Premium

Gridbot

A command language moves a bot around an obstacle grid, with pathfinding to a target, parsing plus graph search, built from scratch.

String / ParsingGraph Search

Problem

A greenfield build: a bot on a grid controlled by a small command language. Clone the starter repo, use your own editor and AI tools, and build it under a 45-minute timer.

The spec

  • Parser: a command language where MOVE N, MOVE S, MOVE E, MOVE W move one cell, and REPEAT k [ … ] repeats a block. Malformed programs (bad tokens, unbalanced brackets, REPEAT 0) must be rejected with a clear error.
  • Simulator: the bot starts at a given cell and runs a parsed program. It stops (and reports) if a move would hit an obstacle or leave the grid.
  • Router: route(from, to) returns the shortest path avoiding obstacles and bounds.

Ship tests for all three parts and a README documenting the language.

What interviewers watch

  • Whether you model the grammar (recursive descent) rather than papering over it with regex
  • Whether the shortest-path choice is BFS and you can say why it's correct for unweighted movement
  • Whether you write the parser and router tests before or after prompting

Submission

Export your code and AI chat transcript, note tools and time, and submit for a verdict.

Deliverables

  • A parser for the command language (MOVE N/E/S/W, REPEAT k [...]), rejecting malformed programs
  • A bot simulator that respects obstacles and bounds
  • route(from, to) using BFS that avoids obstacles
  • Tests for the parser, simulator, and router