Bolodefchoco_LUAXML

[Pedido] Memory

Oct 9th, 2016
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1. os.execute("title Memory Game (From Lautenschlager)")
  2.  
  3. system = {}
  4. system.sleep = function(time)
  5.     local timer = os.time() + time
  6.     while timer > os.time() do
  7.     end
  8. end
  9.  
  10. summon = function(dif)
  11.     system.sleep(2)
  12.     os.execute("cls")
  13.     local i = {"<","<",">",">","<","<","<",">",">",">"}
  14.     local c = 8
  15.     if dif >4 and dif < 10 then
  16.         i = {"<",">","^","<",">","^","<",">","^","<",">","^","<",">","^"}
  17.         c = 18
  18.     elseif dif > 9 and dif < 15 then
  19.         i = {"<",">","^","@","<",">","^","@","<",">","^","@","<",">","^","@","<",">","^","@"}
  20.         c = 48
  21.     elseif dif > 14 then
  22.         i = {"<",">","^","@","!","<",">","^","@","!","<",">","^","@","!","<",">","^","@","!","<",">","^","@","!"}
  23.         c = 78
  24.     end
  25.     dif = dif + 3
  26.     os.execute("color "..c)
  27.     local sequence,done = {},0
  28.     for v = 1,dif do
  29.         table.insert(sequence,math.random(#sequence+1),i[math.random(#i)])
  30.     end
  31.     while done <= #sequence do
  32.         local sq = ""
  33.         for i = 1,done do
  34.             sq = sq .. "  " .. sequence[i]
  35.         end
  36.         io.write("\t\t/!\\ Sequence (Lv. "..(dif - 2)..") /!\\\t\t\n\n     "..sq)
  37.         system.sleep(1.5)
  38.         os.execute("cls")
  39.         done = done + 1
  40.     end
  41.     io.write("Sequence: ")
  42.     local answer = io.read()
  43.     if answer:gsub(" ","") == table.concat(sequence) then
  44.         os.execute("color 2")
  45.         print("\nSuccess!")
  46.         summon(dif - 2)
  47.     else
  48.         os.execute("color 4")
  49.         print("\nFail!")
  50.         summon(dif - 3)
  51.     end
  52. end
  53.  
  54. summon(0)
Advertisement
Add Comment
Please, Sign In to add comment