Advertisement
TomatoSoup

Untitled

Apr 12th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local redin = "right"
  3. local redout = "bottom"
  4. local printerside = "left"
  5. math.randomseed(os.time())
  6.  
  7. local printer = peripheral.wrap(printerside) -- Wrap the printer
  8.  
  9. local stopme = true
  10.  
  11. local result, n1, n2, n3, hash, ready
  12.  
  13. while (true) do
  14. ready = printer.newPage()
  15. n1 = math.random(20)
  16. n2 = math.random(20)
  17. n3 = math.random(20)
  18. hash = (n1*n2*n3*541)%(n1+n2+n3+29) --10th and 100th primes
  19. result = n1 .. " " .. n2 .. " " .. n3 .. "\nHash Code: " .. hash
  20. write("Your lotto numbers are!\n" .. result .. "\n\nMake sure you grab your ticket.\n\n")
  21. if ready then
  22. printer.write(result)
  23. printer.setPageTitle("Lotto Ticket")
  24. printer.endPage()
  25. redstone.setOutput(redout, true)
  26. sleep(10)
  27. redstone.setOutput(redout, false)
  28. else
  29. error("Could not create a page. Is there any paper and ink in the printer?\n")
  30. end
  31.  
  32. shell.run("clear")
  33. write("Press enter for your ticket!\n\n")
  34. result = read()
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement