Advertisement
guitarplayer616

Sc2 Memorization Tool Proof Of Concept

Apr 24th, 2017
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.86 KB | None | 0 0
  1. --[[13 overlord
  2. 17 hatch, gas, pool
  3. @hatch queens, lings, metaboost
  4. @metaboost hatch, roach warren, 2xgas,4xroaches
  5. @hatch queen, evo chambers, lair, gas, 10xlings
  6. @evo chambers +1/+1, 2xgas, roach speed, 5x ravagers]]
  7.  
  8.  
  9.  
  10. local memorize = {
  11.     {"13","overlord"},
  12.     {"17","hatch", "gas", "pool"},
  13.     {"@hatch","2x queens", "2x lings", "metaboost"},
  14.     {"@metaboost","hatch", "roach warren", "2x gas","4x roaches"},
  15.     {"@hatch", "queen", "2x evo chambers", "lair", "gas", "10x lings"},
  16.     {"@evo chambers", "+1/+1", "roach speed", "2xgas", "5x ravagers"},
  17.     {"@roach speed","4th hatch","mass roach","attack"},
  18. }
  19.  
  20. function showAns()
  21.     --cprint("3 base roach/ravager",colors.yellow)
  22.     for n,t in pairs(memorize) do
  23.         cwrite(t[1],colors.orange)
  24.         cprint(": "..table.concat(t,", ",2),colors.white)
  25.     end
  26. end
  27.  
  28. function cprint(str,txt,bak)
  29.     local txt = txt or colors.white
  30.     local bak = bak or colors.black
  31.     term.setTextColor(txt)
  32.     term.setBackgroundColor(bak)
  33.     if str then
  34.         print(str)
  35.     end
  36. end
  37.  
  38. function cwrite(str,txt,bak)
  39.     local txt = txt or colors.white
  40.     local bak = bak or colors.black
  41.     term.setTextColor(txt)
  42.     term.setBackgroundColor(bak)
  43.     if str then
  44.         write(str)
  45.     end
  46. end
  47.  
  48. function test()
  49.     shell.run("clr")
  50.     local success = true
  51.     for i = 1,#memorize do
  52.         cwrite(memorize[i][1]..": ",colors.orange)
  53.         cwrite(_,colors.white)
  54.         local ans = read()
  55.         ans = string.gsub(ans,"%s","")
  56.         cprint(ans,colors.yellow)
  57.         if ans == string.gsub(table.concat(memorize[i],",",2),"%s","") then
  58.             cprint("CORRECT",colors.green)
  59.         else
  60.             cprint("WRONG",colors.red)
  61.             cprint(table.concat(memorize[i],",",2),colors.red)
  62.             success = false
  63.             break
  64.         end
  65.     end
  66.     if success then
  67.         cprint(_,colors.orange)
  68.         textutils.slowPrint("CONGRATULATIONS")
  69.     end
  70. end
  71.  
  72. shell.run("clr")
  73. showAns()
  74. cprint("\n".."press any key to begin",colors.yellow)
  75. os.pullEvent("key")
  76. test()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement