Advertisement
Doob

clock

Jul 16th, 2016
1,735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. local gpu = require("component").gpu
  2. local w, h, t, q = gpu.getResolution()
  3. local numb, ha, wh, p, s, u, e, gsB, gS, ti, r, slp, tn = {29850,29351,30887,18925,14735,27343,9383,31407,31147,[0]=31599}, h/2-2, {0, 8, nil, 18, 26}, "▀", "  ", h%2, w/2, gpu.setBackground, gpu.set, table.insert, math.random, os.sleep, tonumber
  4.  
  5. local function drawN(x, y, n)
  6.   local c = 0
  7.   for i = 0, 14 do
  8.     if bit32.extract(numb[n], i) == 1 then
  9.       gsB(60928)
  10.       gS(x, y, s)
  11.     else
  12.       gsB(0)
  13.       gS(x, y, s)
  14.     end
  15.     c, x = c + 1, x + 2
  16.     if c % 3 == 0 then
  17.       y, x = y + 1, x - 6
  18.     end
  19.   end
  20. end
  21.  
  22. gsB(0)
  23. gpu.fill(1, 1, w, h, " ")
  24. local tbl = {x = {}, y = {}}
  25. for x = 1, w, 2 do
  26.   for y = 1, ha-1-u do
  27.     ti(tbl.x, x)
  28.     ti(tbl.y, y)
  29.   end
  30. end
  31. for n = 1, #tbl.x do
  32.   k = r(n)
  33.   tbl.x[n], tbl.x[k], tbl.y[n], tbl.y[k] =
  34.   tbl.x[k], tbl.x[n], tbl.y[k], tbl.y[n]
  35. end
  36. while true do
  37.   q = 1
  38.   for i = 1, #tbl.x do
  39.     gpu.setForeground(r(tbl.x[i]*tbl.y[i])*512)
  40.     gS(tbl.x[i], tbl.y[i], p)
  41.     gS(-tbl.x[i]+w, -tbl.y[i]+h+1, p)
  42.     q = q + 1
  43.     if q == 55 then
  44.       t = os.date("%T")
  45.       for o = 1, 5 do
  46.         if o ~= 3 then
  47.           drawN(e+wh[o]-15, ha+u, tn(t:sub(o,o)))
  48.         end
  49.       end
  50.       if tn(t:sub(5, 5))%2 == 0 then
  51.         gsB(60928)
  52.       else
  53.         gsB(0)
  54.       end
  55.       gS(e, ha+1+u, s)
  56.       gS(e, ha+3+u, s)
  57.       gsB(0)
  58.       q = 1
  59.       slp(0.05)
  60.     end
  61.     slp()
  62.   end
  63.   slp(0.05)
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement