2 grammar
source | link

Python3 (288)

Implementation using heavy use of ternary ifs.

m=['N','E','S','W']
cords=[int(n) for n in input().split()] + [input()] #Convert first inputs to integers and retrieve third
for n in input(): #Get instructions
    if n=='M':
        i=[1,0][cords[2] in m[1:3]] #See if vertical or horizontal
        j=[-1,1][cords[2] in m[0:2]] #See if negative or positive
        cords[i]+=j
    else:
        i=[-1,1][n=='R'] #Translate turn to numerals
        cords[2]=m[m.index(cords[2])+i] #Change direction relative to current orientation
print(cords)

Omitting the obvious input grumbles, giving the direction strings intrinsic values may have benefited the script size. However, the approach here is perfectly functional (so I believe)

Python3 (288)

Implementation using heavy use of ternary ifs.

m=['N','E','S','W']
cords=[int(n) for n in input().split()] + [input()] #Convert first inputs to integers and retrieve third
for n in input(): #Get instructions
    if n=='M':
        i=[1,0][cords[2] in m[1:3]] #See if vertical or horizontal
        j=[-1,1][cords[2] in m[0:2]] #See if negative or positive
        cords[i]+=j
    else:
        i=[-1,1][n=='R'] #Translate turn to numerals
        cords[2]=m[m.index(cords[2])+i] #Change direction relative to current orientation
print(cords)

Omitting the obvious input grumbles, giving the direction strings intrinsic may have benefited the script size. However, the approach here is perfectly functional (so I believe)

Python3 (288)

Implementation using heavy use of ternary ifs.

m=['N','E','S','W']
cords=[int(n) for n in input().split()] + [input()] #Convert first inputs to integers and retrieve third
for n in input(): #Get instructions
    if n=='M':
        i=[1,0][cords[2] in m[1:3]] #See if vertical or horizontal
        j=[-1,1][cords[2] in m[0:2]] #See if negative or positive
        cords[i]+=j
    else:
        i=[-1,1][n=='R'] #Translate turn to numerals
        cords[2]=m[m.index(cords[2])+i] #Change direction relative to current orientation
print(cords)

Omitting the obvious input grumbles, giving the direction strings intrinsic values may have benefited the script size. However, the approach here is perfectly functional (so I believe)

1
source | link

Python3 (288)

Implementation using heavy use of ternary ifs.

m=['N','E','S','W']
cords=[int(n) for n in input().split()] + [input()] #Convert first inputs to integers and retrieve third
for n in input(): #Get instructions
    if n=='M':
        i=[1,0][cords[2] in m[1:3]] #See if vertical or horizontal
        j=[-1,1][cords[2] in m[0:2]] #See if negative or positive
        cords[i]+=j
    else:
        i=[-1,1][n=='R'] #Translate turn to numerals
        cords[2]=m[m.index(cords[2])+i] #Change direction relative to current orientation
print(cords)

Omitting the obvious input grumbles, giving the direction strings intrinsic may have benefited the script size. However, the approach here is perfectly functional (so I believe)