Writing clock in Ruby

Got a programming project in mind? Tell everyone about it!
Post Reply
2600Sam
Posts: 12
Joined: Thu Jul 30, 2020 6:04 am

Writing clock in Ruby

Post by 2600Sam »

NOPE I did NOT write this program but I thought it was awesome and wanted to share. It's written in RUBY
Yes the code is supposed to have all the spaces in it as it displays the code as the body of the clock and the face is in the center
Original post is here https://mametter.hatenablog.com/entries/2016/02/09
and a very brief video of it in action https://www.youtube.com/watch?v=pgAHW8O ... e=emb_logo
I have attached the program down below in a zipped format.
It should run on anything that you can run RUBY on just increase the size of the command window before you execute it.
execute = 'ruby clock.rb'
I could waste a whole day watching the inexorable march of time on this . . .

Code: Select all

                         eval(T=%(eval(%(E=27.chr;Z=32.chr;$
                    ><<E+"[2J";K=->q{(q-q*(1-3844.0/q.abs2)**0.5)
                /2};I=->f,a,b,z,t=p{(a-b).abs>(f<1?1:1-(K[a]-c=K[b]).
             abs)?I[f,c=                                     (a+b)/2,b,I
           [f,a,c,z,t],t  :''''''''''''''''''''''''''''''':  ]:f<1?(x,y=b.
         rect;d="'."[y%2  :                               :  ];c=z[y/2+5];c[
       x+=58]=t||(c[x]==  :                               :  d||Z==c[x]?d:?:))
     :(puts(E+"[H"+$/+I[  :                               :  0,c,0,I[0,b,c,z.map
    (&:b)]]*$/);t||I[0,b  :         Writing Qlock         :  ,c,z,Z];sleep(0.01))
    ;z};s=(Z*25+"eval(T=  :                               :  %("+T+"))").lines.ma
   p{|l|l.chomp.ljust(90  :     (C) Yusuke Endoh 2016     :  )};loop{z=0i-31,[-1.0
   ,Z];h=10i-30;a="5?GUV  :                               :  XIIPCM.AAN&,HY/ZZZO7[
   &,HY3'CE<5SM5.OOJ+BBT  :                               :  3LV+A&YQ.STT[MF.KUVXP
   K+&[AOOJ'&5?GU57-B5SI  :                               :  51>E<5PCMF.K,DXPD+SM7
   .77'";i=92;"Q+3_.DW'`  :          inspired by          :  HAD,A11R`NK+HILJ/D'&F
    1.CG371|BE@355?5A7@@  :                               :  ??7|3-5-".scan(/../)
    {a.gsub!("%c"%i-=1,$  :    https://t.co/NSBi45Lj77    :  &)};Time.now.strftim
     e("%H:%M").bytes{|c  :                               :  |q=h;a.split(?&)[c-
       48].scan(/([0-8])  :                               :  |./){$1?q+=(n=$1.
         hex)%3-1+(n/3-1  :                               :  )*2i:z<<[q,$&]}
           ;h+=6};z<<a=3  :...............................:  1i-31;31.time
             s{|y|s[y/2+                                     5][58]=Z};g
                =z.map{|b,h|x,y=a.rect;g&&s[y/2+5][x+58]=g;I[1,a,b,s,
                    g];a,g=b,h};sleep(61-Time.now.sec);;;}).gsub(
                         /^(.{26}):.{32}/){$1}.split*"")##))
                         
clock.zip
ziped source code
(1.03 KiB) Downloaded 16 times

Post Reply