Cheating with Ruby
summary
A Ruby script called PetDetector RubyGem analyzes a game screenshot, uses RMagick for image ops, phashion perceptual hashes to identify pets and houses, probes edges to find the road, builds a graph and runs Dijkstra shortest-paths, then a constrained recursive solver that respects the four-pet capacity and limited gas. It reliably solves many levels (breaks on noisy screenshots) and typically runs in one to four seconds for level 12.
AI-written summary · about
chapters (13)
- 0:00Start
- 2:11Pet Detective
- 7:16Pet Detector
- 8:03Live Demo
- 12:28Identify the Boundaries of the Game Boards
- 13:26Entity Detector
- 13:52Boundary Detector Class
- 14:12The Boundary Detector
- 19:22Animal Detector
- 24:40Detecting the Roads
- 35:08Solve Function
- 37:24Strategic Takeaways
- 38:27How Long Does It Take To Run for the Higher Levels








