Skip to content

Instantly share code, notes, and snippets.

@Shaddyjr
Last active June 18, 2019 21:46
Show Gist options
  • Save Shaddyjr/d75d4367f74ce2cce2380a6f0d66e09b to your computer and use it in GitHub Desktop.
Save Shaddyjr/d75d4367f74ce2cce2380a6f0d66e09b to your computer and use it in GitHub Desktop.
def dirReduc(arr):
directions = {
"NORTH" : "SOUTH" ,
"SOUTH" : "NORTH" ,
"WEST" : "EAST" ,
"EAST" : "WEST"
}
for i in range(len(arr)-1):
move = arr[i]
next_move = arr[i+1]
if (next_move == directions[move])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment