Advertisement
Doob

clock53

Apr 9th, 2020
774
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. local bg_color = 0x000000
  2. local text_color = 0x00ee00
  3.  
  4. local gpu = require("component").gpu
  5. local extract = require('bit32').extract
  6. local w, h, t, q = gpu.getResolution()
  7. 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
  8.  
  9. local function drawN(x, y, n)
  10.   local c = 0
  11.   for i = 0, 14 do
  12.     if extract(numb[n], i) == 1 then
  13.       gsB(text_color)
  14.       gS(x, y, s)
  15.     else
  16.       gsB(bg_color)
  17.       gS(x, y, s)
  18.     end
  19.     c, x = c + 1, x + 2
  20.     if c % 3 == 0 then
  21.       y, x = y + 1, x - 6
  22.     end
  23.   end
  24. end
  25.  
  26. gsB(bg_color)
  27. gpu.fill(1, 1, w, h, " ")
  28. local tbl = {x = {}, y = {}}
  29. for x = 1, w, 2 do
  30.   for y = 1, ha-1-u do
  31.     ti(tbl.x, x)
  32.     ti(tbl.y, y)
  33.   end
  34. end
  35. for n = 1, #tbl.x do
  36.   k = r(n)
  37.   tbl.x[n], tbl.x[k], tbl.y[n], tbl.y[k] =
  38.   tbl.x[k], tbl.x[n], tbl.y[k], tbl.y[n]
  39. end
  40. while true do
  41.   q = 1
  42.   for i = 1, #tbl.x do
  43.     gpu.setForeground(r(tbl.x[i]*tbl.y[i])*512)
  44.     gS(tbl.x[i], tbl.y[i], p)
  45.     gS(-tbl.x[i]+w, -tbl.y[i]+h+1, p)
  46.     q = q + 1
  47.     if q == 55 then
  48.       t = os.date("%T")
  49.       for o = 1, 5 do
  50.         if o ~= 3 then
  51.           drawN(e+wh[o]-15, ha+u, tn(t:sub(o,o)))
  52.         end
  53.       end
  54.       if tn(t:sub(5, 5))%2 == 0 then
  55.         gsB(text_color)
  56.       else
  57.         gsB(bg_color)
  58.       end
  59.       gS(e, ha+1+u, s)
  60.       gS(e, ha+3+u, s)
  61.       gsB(bg_color)
  62.       q = 1
  63.       slp()
  64.     end
  65.     slp()
  66.   end
  67.   slp()
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement