First we have to
consider the die whose top 1, bottom 6, north 2, south 5 west 3 and east
4. Our moving command is "north", "east", "south",
or "west". To check which command is to execute we do not need to
compare the whole word but just the first character n,e,s,w. Now
simulate it correctly, For example: If the die is in initial position
and the moving command is north then after moving the position of the
die is top 5, south 6, bottom 2, north 1 west 3 and ease 4. |