🌍 Become a marimo ambassador!

Apply
97 / 103
Wanderland

An interactive coding playground: guide Mo the Mossball through puzzle worlds by writing Python.

About this notebook

Wanderland is a coding puzzle for a character named Mo. Mo lives in a small 3D grid world. The first puzzle, Gem Path, comes from the wanderland package. The notebook uses marimo, pandas, and wanderland. In Gem Path, Mo must collect two gems and finish on a golden goal ring. A pond blocks the center of the grid, so Mo must travel around it.

You guide Mo by writing Python commands. The four commands are move_forward(), turn_left(), turn_right(), and collect_gem(). You type them in a code editor, or you tap buttons to add each command. The notebook builds these controls with mo.ui.code_editor and mo.ui.button. Press Run My Code in the 3D scene to run Mo's plan. A callout then reports the gem count and whether Mo reached the goal. You can drag the scene to rotate the camera and scroll to zoom.

A second section lets you design your own world. A spreadsheet editor, mo.ui.data_editor, holds one symbol per tile. Each symbol sets a tile type, such as grass, wall, water, lava, gem, key, door, or goal. When you edit a cell, the notebook rebuilds the 3D world. The world renders through mo.ui.anywidget. A shared mo.state keeps the program text in one place, so the editor and the buttons stay in agreement.

Related notebooks