DEV Community

Cover image for Scratch – Solve Maze Problem automatically
Be Here Now
Be Here Now

Posted on

1

Scratch – Solve Maze Problem automatically

The problem is to solve the maze automatically without any mouse or keyboard actions.

Scratch

https://scratch.mit.edu/projects/644610721/embed

The main idea is to bind two colors blocks at the **top **and the **bottom **of the dog which will get out of the maze. The top color is greenand the bottom color is purple. If the greencolor touches the blackcolor which is the maze line, then turn right. If the purplecolor touches the blackcolor, then turn left. A redcolor is bind to the head of the dog, which is used to detect the head blackcolor. If the head touches the blackcolor, then turn back.

Sprite’s Costume

Turn right is the default option, and turn left is also feasible. Sometimes turning left may speed up the solving speed but highly dependent the map.

Scratch code to solve maze problem

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay