Snippets

cia_rana メビウスの亀

Created by cia_rana
x=y=0
d=2
gets.chars.each{|c|
  case c
  when ?R
    d=(d-1)%4
  when ?L
    d=(d+1)%4
  when ?B
    d=(d+(d%2)*2)%4
    y=9-y
  else
    e=(d/2*2-1)*c.to_i
    xt=x
    x=(x+e*((d+1)%2))%32
    y=(y+e*(d%2)+((xt-x).abs>9?5:0))%10
  end
}
puts [x+1,(y<5?y+97:65+y%5).chr]*""

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.