Skip to content

Repository files navigation

Wiki-Solver

What does it do?

  1. Takes two (usually random) wikipedia articles as input
  2. Finds a path between them, using only wiki links starting on those pages
  3. Prints the path between the two articles

How to run

  • run python -m solver_core.cli
  • type in wikipedia links
    • they can be either a wiki link or the title of an article
    • quotes are necessary for command line args if the title has spaces

Examples:

Normal:

> python -m solver_core.cli
starting link: https://en.wikipedia.org/wiki/Avengers_(comics)
ending link: The Room
Searching...

Avengers_(comics)
Captain America: The First Avenger
Chris Evans (actor)
James Franco
The Room

Command line args:

> python -m solver_core.cli "Elon Musk" Muskrat
Searching...

Elon Musk
Mars Society
California
Utah
Muskrat

Da Rules:

Made using Python 3.

Visualizer

An interactive visualizer runs on the same shared solver_core package as the CLI:

One-command local dev

> python3 -m pip install -r visualizer_backend/requirements.txt
> cd frontend && npm install && cd ..
> ./scripts/start-visualizer-dev.sh

This starts:

  • the backend at http://127.0.0.1:8000
  • the frontend at http://127.0.0.1:5173

If either port is already occupied, the script selects the next available port and prints the URLs it chose. Set BACKEND_PORT or FRONTEND_PORT to choose the starting ports explicitly. The script uses env/bin/python or .venv/bin/python when present; set PYTHON_BIN to select another interpreter.

One-command Docker

> docker compose up --build

This serves the built frontend and API together at http://127.0.0.1:8000.

Manual startup

> python3 -m pip install -r visualizer_backend/requirements.txt
> HOST=127.0.0.1 PORT=8000 RELOAD=1 python3 -m visualizer_backend
> cd frontend
> npm install
> VITE_API_PROXY_TARGET=http://127.0.0.1:8000 npm run dev

python -m visualizer_backend now supports HOST, PORT, and RELOAD environment variables. The Vite dev server proxies /api HTTP and WebSocket requests to VITE_API_PROXY_TARGET, which defaults to http://127.0.0.1:8000. Wikipedia requests are serialized and retried automatically when Wikimedia throttles the client. WIKI_API_MIN_INTERVAL controls the default 0.35-second spacing and WIKI_API_MAX_RETRIES controls the default four retries.

About

beats the wikipedia game so you don't have to

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages