Working with strings

i'm curious how the code manages direction -- know what direction to turn to before moving some "dist"