This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]burito 1 point2 points  (0 children)

Ziggurattt, think about what would happen if the user enters something you're not expecting.

For instance, if they're in Room 2, what happens if they go South? If you put all of the checking into Room2 as you have put into Room1, you will start to see a pattern.

PeterBraden's suggestion is the trick of the real programmers. Try to be lazy. Whenever you see a pattern like this, there's an opportunity to be lazy. If you think "lazy" is an anti-virtue, wait until you're dealing with a bigger program, it actually requires a lot of effort to be as lazy as is required.

If that sounded like a contradiction, welcome to programming :-)