Skip to content

Interactive search widgets for the notebooks and the browser companion - #1357

Open
dmeoli wants to merge 4 commits into
masterfrom
feature/widgets
Open

dmeoli wants to merge 4 commits into
masterfrom
feature/widgets

Conversation

@dmeoli

@dmeoli dmeoli commented Nov 19, 2026

Copy link
Copy Markdown
Member

this adds interactive pictures of the search algorithms that run in the browser, also in the JupyterLite companion

aima/widgets.py has a step-through player (Play, Step, Reset, a slider and the speed) built on ipywidgets only, with views for the Romania map (frontier, explored, current city, final path and cost), the 8-puzzle (tiles sliding) and n-queens
there is also an 8-puzzle to solve by clicking the tiles, which at the end compares your moves with the optimum found by A*

the search functions are unchanged: RecordingProblem in search.py wraps the problem and records the expansions, and the player replays them

to try it: cd lite && ./build.sh, serve lite/_output and open search.ipynb
python verify_browser.py --lab search runs that notebook in the JupyterLite app and clicks through the widgets

…tion

It wraps a problem like InstrumentedProblem and turns the run into steps
(state expanded, frontier, explored, and the path found), so that a search can
be replayed without changing the search functions.
…gets

The views are SVG in an HTML widget, timed by a Play widget in the browser, so
they run in Jupyter and in JupyterLite with no other widget library: a player
for a search on the Romania map, one for the 8-puzzle solution with sliding
tiles, one for n-queens, and an 8-puzzle the user solves by clicking.
build.sh bundles the ipywidgets wheels so that the notebook works offline, and
verify_browser.py --lab runs a notebook in the JupyterLite app, presses the
player buttons, clicks the 8-puzzle tiles and saves screenshots.
Larger tiles with bold numbers, a light blank square, the tiles that can move
outlined on hover, and a one-line status.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant