Guest User

Neotation.lua

a guest
Jun 20th, 2022
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. -- ask for alg input
  2. io.write("put in your algorithm: ")
  3. local alg = io.read()
  4.  
  5. -- translation tables to translate
  6. local trans1 = {
  7.     ["R'"] = "rv", ["U'"] = "u>", ["L'"] = "l^", ["F'"] = "f<", ["D'"] = "d<", ["B'"] = "b>", ["M'"] = "m^", ["E'"] = "e<", ["S'"] = "s<"
  8. }
  9. local trans2 = {
  10.     ["R"] = "r^", ["U"] = "u<", ["L"] = "lv", ["F"] = "f>", ["D"] = "d>", ["B"] = "b<", ["M"] = "mv", ["E"] = "e>", ["S"] = "s>"
  11. }
  12. local trans3 = {
  13.     ["R2"] = "r2", ["U2"] = "u2", ["L2"] = "l2", ["F2"] = "f2", ["D2"] = "d2", ["B2"] = "b2", ["M2"] = "m2", ["E2"] = "e2", ["S2"] = "s2"
  14. }
  15.  
  16. -- wide moves because someone asked
  17. local trans4 = {
  18.     ["Rw'"] = "Rv", ["Uw'"] = "U>", ["Lw'"] = "L^", ["Fw'"] = "F<", ["Dw'"] = "D<", ["Bw'"] = "B>", ["Mw'"] = "M^", ["Ew'"] = "E<", ["Sw'"] = "S<"
  19. }
  20. local trans5 = {
  21.     ["Rw"] = "R^", ["Uw"] = "U<", ["Lw"] = "Lv", ["Fw"] = "F>", ["Dw"] = "D>", ["Bw"] = "B<", ["Mw"] = "Mv", ["Ew"] = "E>", ["Sw"] = "S>"
  22. }
  23. local trans6 = {
  24.     ["Rw2"] = "R2", ["Uw2"] = "U2", ["Lw2"] = "L2", ["Fw2"] = "F2", ["Dw2"] = "D2", ["Bw2"] = "B2", ["Mw2"] = "M2", ["Ew2"] = "E2", ["Sw2"] = "S2"
  25. }
  26.  
  27. -- translate the moves to neomoves
  28. print((alg:gsub("%S+", trans1):gsub("%S+", trans2):gsub("%S+", trans3):gsub("%S+", trans4):gsub("%S+", trans5):gsub("%S+", trans6)))
Advertisement
Add Comment
Please, Sign In to add comment