Advertisement
PaymentOption

Random Smile

Oct 10th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. function getNumber()
  2.     local tCharacters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}
  3.     local bShouldBeNumber = false;
  4.  
  5.     if math.random(0, 1) == 1 then
  6.         bShouldBeNumber = true;
  7.     end
  8.  
  9.     if bShouldBeNumber then
  10.         return math.random(0, 9)
  11.     else
  12.         return tCharacters[math.random(1, 26)]
  13.     end
  14. end
  15.  
  16. function printEye_Left()
  17.     printNumbers(2, 49/2 - 3, 2, 19/2 - 2)
  18. end
  19.  
  20. function printEye_Right()
  21.     printNumbers(49/2 + 4, 50, 2, 19/2 - 2)
  22. end
  23.  
  24. function printMouth_LeftSide()
  25.     printNumbers(2, 49/2 - 14, 19/2 + 2, 17)
  26. end
  27.  
  28. function printMouth_RightSide()
  29.     printNumbers(49/2 + 17, 50, 19/2 + 2, 17)
  30. end
  31.  
  32. function printMouth_Middle()
  33.     printNumbers(2, 49/2 + 17, 19/2 + 5, 17)
  34. end
  35.  
  36. function printNose()
  37.     printNumbers(49/2 - 2, 49/2 + 3, 19/2 - 1, 19/2 + 2)
  38. end
  39.  
  40. function printNumbers(x_start, x_end, y_start, y_end)
  41.     for xPos = x_start, x_end do
  42.         for yPos = y_start, y_end do
  43.             term.setCursorPos(xPos, yPos)
  44.             term.write(getNumber())
  45.         end
  46.     end
  47. end
  48.  
  49. while true do
  50.     term.clear()
  51.     term.setCursorPos(1, 1)
  52.  
  53.     printEye_Right()
  54.     printEye_Left()
  55.  
  56.     printMouth_RightSide()
  57.     printMouth_LeftSide()
  58.     printMouth_Middle()
  59.  
  60.     printNose()
  61.     sleep(0.1)
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement