Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

http://imgur.com/Nvy8u

Here's one with same amount of code and optimal logic (for this map) without hard coding. It also ensures that there is a forward step in every iteration of the while loop.

Basically it's just an order of preference:

Turn right > turn left > go straight



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: