Really nice puzzle, indeed. I understood the logic and what condition will make the game terminate.
However, there are two things I just do not understand.
First, what are the first 4 input characters of each turn or rather what do they determine.
Second, I do not understand what limits/hinders my movement as it often stops way before the actual game borders..