Ben,

I have such a dictionary in my first attempt to solve this one.
and another one for the facing.


Lets say we have this scenario:

Robot begins at (0,0) facing north
then it turns right so it faces west
then it moves one step so the new position is (-1,0)
then it turns left so it faces north again
then it moves one step so the  new position is (-1,1)

so if I see it , the position has nothing to do with the direction the robot is facing this is only important for finding out a new direction or  to find out if the x or the y needs to change.

Roelof



Op 18-4-2019 om 19:27 schreef Ben Coman:
map := Dictionary newFromPairs: {
         'north'.  0 @  1 .
         'south'.  0 @ -1 .
         'east'.   1 @  0 .
         'west' . -1 @  0 }.
     (map at: 'north') inspect.
     (map keyAtValue: 0 @ -1) inspect



Reply via email to