If the current direction is East
elif ( p == ' E ' ) : NEW_LINE INDENT if ( a [ i ] == ' U ' ) : NEW_LINE INDENT p = ' E ' NEW_LINE e = e + b [ i ] NEW_LINE DEDENT elif ( a [ i ] == ' D ' ) : NEW_LINE INDENT p = ' W ' NEW_LINE w = w + b [ i ] NEW_LINE DEDENT elif ( a [ i ] == ' R ' ) : NEW_LINE INDENT p = ' S ' NEW_LINE s = s + b [ i ] NEW_LINE DEDENT elif ( a [ i ] == ' L ' ) : NEW_LINE INDENT p = ' N ' NEW_LINE n = n + b [ i ] NEW_LINE DEDENT DEDENT