[{"data":1,"prerenderedAt":28},["ShallowReactive",2],{"game-maze-runner":3},{"id":4,"title":5,"description":6,"difficulty":7,"board":8,"instructions":23,"boardHint":24,"stateTypeName":25,"stateTypeLib":26,"starterCode":27},"maze-runner","Maze Runner","Guide a robot through a 5x5 grid full of obstacles to reach the goal.","easy",{"grid":9,"start":11,"goal":13,"obstacles":15},{"width":10,"height":10},5,{"x":12,"y":12},0,{"x":14,"y":14},4,[16,18,20,22],{"x":17,"y":17},1,{"x":19,"y":17},2,{"x":19,"y":21},3,{"x":21,"y":21},"Write a function solve(state) that returns \"up\", \"down\", \"left\" or \"right\".\n\nIt is called once per step until you reach the goal or run out of steps.\n\nstate = {\n  x, y,              \u002F\u002F your current position\n  goal: { x, y },    \u002F\u002F the exit\n  grid: { width, height },\n  obstacles: [{ x, y }, ...],\n  stepsTaken\n}\n\n(0, 0) is the top-left corner. \"down\" increases y, \"right\" increases x.","Get the blue robot from the start to the green goal, avoiding red obstacles.","MazeRunnerState","interface Position {\n  x: number;\n  y: number;\n}\n\ninterface MazeRunnerState {\n  \u002F** Your robot's current column. *\u002F\n  x: number;\n  \u002F** Your robot's current row. *\u002F\n  y: number;\n  \u002F** The exit you're trying to reach. *\u002F\n  goal: Position;\n  \u002F** The size of the board. *\u002F\n  grid: { width: number; height: number };\n  \u002F** Cells you cannot move onto. *\u002F\n  obstacles: Position[];\n  \u002F** How many moves you've made so far. *\u002F\n  stepsTaken: number;\n}\n\ntype Move = \"up\" | \"down\" | \"left\" | \"right\";\n","\u002F**\n * @param {MazeRunnerState} state\n * @returns {Move}\n *\u002F\nfunction solve(state) {\n  \u002F\u002F Naive strategy: walk along the top row to the goal's column, then straight\n  \u002F\u002F down. It reaches the goal, but it doesn't actually look at obstacles -\n  \u002F\u002F try writing something that reacts to state.obstacles and finds a shorter\n  \u002F\u002F or smarter path instead.\n  if (state.x \u003C state.goal.x) return \"right\";\n  if (state.y \u003C state.goal.y) return \"down\";\n  return \"up\";\n}\n",1789826988392]