Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

New Workshop: More JavaScript Maze

I'm happy to announce that we launched the thrilling conclusion (part two) of my object-oriented JavaScript workshop for Gold members yesterday. In this workshop, I walk step-by-step through how I would solve the following programming problem:

Write a computer program that represents a robot
in a maze and leads him to the exit.

Here's a link to both parts, along with the full description for part two:

After you learn the basic building blocks of a programming language, there's still a lot to learn about when to use each one and how to make them all work together. In this workshop, Randy will walk you step-by-step through solving a programming problem. You'll get to listen in on discussions between Treehouse teachers, gaining insight into how programmers think and work. In Part 2, Randy and Andrew discuss the solution to the problem at a high level, and then Randy uses the robot and maze model to hammer out the details of the algorithm. You'll discover ways to improve your own workflow and code — whatever language you're working in.

Kostas Oreopoulos
Kostas Oreopoulos
15,184 Points

Basically the algorithm could be a tad simpler. When you want to follow a left wall, you simple do (in meta-algorithm) function solveMaze() if(canGoLeft()) turnLeft() ; return "left"; if(canGoForward()) goForward();return "forward" ; if (canGoRight()) go Right(); return "right"; turnBack();return "back";

you can now even accumulate the returns into an array (named solution) and have it in a humanly readable format

So basically you just prioritize your movements (left,forward,right,back) , which is much simpler to follow

5 Answers

John Wheal
John Wheal
27,969 Points

I have found this so useful. Any more videos like this would be great!

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

Glad to hear it, John! :~)

You ask for more videos "like this": would you mind explaining a little bit what exactly you'd like to see more of?

James Barnett
James Barnett
39,199 Points

@John - If you want to work on some JavaScript projects like Hangman & Minesweeper check out CodeGarage's JavaScript projects

John Wheal
John Wheal
27,969 Points

@Randy I am talking about videos that show you solving semi-complex problems and thinking about the algorithms.

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

@John - Got it! I'll be sure to pass that feedback along; I'd love to make more tutorials like this one.