Skip to content
Muhammad Musa
← All work

Simulation & optimization

Three cats. Fifteen turns. A better plan.

I built a screenshot-to-plan workspace for a grid puzzle: review the board, search within a money limit, and inspect the result one turn at a time.

My role

I built the screenshot reader, editable board, rule-based simulator, time-bounded search and replay interface, refining the rules against supplied in-game instructions.

Where it stands

Working planner with source kept private. Screenshot interpretation needs review; scores are model predictions, not an observed Roblox result or proof of optimality.

What changed.

A saved 60-second search on the included example found a predicted 213,625 power using a $200 total budget. All three cats reached their beds in the simulator.

Start with the board, not the answer

The reader converts a screenshot into 35 editable cells, including top- and bottom-floor commands. The image stays alongside the interpretation. Four-point alignment handles a changed crop, and money is entered explicitly rather than guessed from the image.

A shared world makes the routes interact

All three cats modify the same buildings. Floors disappear, commands run in order, collisions happen before destination effects, and bed bonuses depend on arrival order. I made those rules explicit before trusting the search score.

Spend a fixed amount of time well

Multiple search restarts explore command placements under the refund-aware budget. Visited floors and distance to beds guide exploration; the reported result remains the actual simulated total. The best valid plan stays available when the run ends or is stopped.

Keep the result inspectable

The output names each tile and floor, explains how to refund existing commands, and provides a turn-by-turn predicted replay. Recognition, simulation and optimization have separate checks, so a wrong board cannot hide behind a convincing score.

What the number does and does not show

The included example has $100 available and $100 in refundable commands. A recorded 60-second run found 213,625; a later 180.05-second run evaluated 99,230,720 candidates without improving it. This is one board and one declared rule model. An actual in-game replay and global optimality remain unverified.

The stack

  • JavaScript
  • Python
  • NumPy
  • Pillow
  • Simulated annealing
  • Worker threads
  • Server-sent events

Try the planner

Read the build story

The article that started the experiment

Open in the playground