54
\$\begingroup\$

Let's make an ASCII art clock and calendar that tells us the current month, day of the month, day of the week, hour, minute, and whether it's night or day (but not the year or second).

At any particular time the calendar will look something like this: (it looks better with less line spacing)

 ________________________________________________________________
|\ ____________________________________________________________ /|
| |                  ___                                       | |
| |                _(   )                                      | |
| |               (___)__)           -.-                       | |
| |                                                            | |
| |                                                            | |
| |      -.-                                                   | |
| |         -.-                                                | |
| |                     ___                                    | |
| |                   _(   )                                   | |
| |                  (___)__)                                  | |
| |                                                            | |
| |                                          ___               | |
| |                                        _(   )              | |
| |    _                                  (___)__)             | |
| |   /|\                                                      | |
| |  / | \                                                     | |
| | /__|__\                                                    | |
| |____|____                                                   | |
| |\_______/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-~~-~~~~~| |
| |____________________________________________________________| |
|/______________________________________________________________\|

It is always a 66 by 23 character "picture frame" whose border never changes.

The image within the frame tells us the time and date:

  • During the day (6:00am - 5:59pm) the month is determined by the number of birds (-.-) in the sky. January = 1 bird, February = 2 birds, etc.
  • During the night (6:00pm - 5:59am) the birds are replaced with 3 times as many stars (*). January = 3 stars, February = 6 stars, etc. Birds and stars are never in the sky at the same time.
  • The day of the month is determined by the number of characters between the two dashes (-) on the water. e.g. ~~-~~~~-~~ means it is the fourth day of the month. Depending on the minute, the boat may need to be between the dashes (the dashes do not loop around).
  • The day of the week is determined by the number of clouds in the sky (all clouds look the same). Sunday = 0 clouds, Monday = 1 cloud, ..., Saturday = 6 clouds.
  • The hour is determined by the level of water (and the boat). At its lowest (as above) it is 1 o'clock, during 2 o'clock it is one character higher, and so on up to 12 o'clock, then back to 1 o-clock. (It's a 12 not a 24 hour clock.)
  • The minute is determined by the horizontal position of the boat. At the top of the hour the boat touches the left edge of the frame (as above). At each subsequent minute the boat moves right by one character. In minutes 51 to 59 it loops from the right side of the frame back to the left.

So, given that the example above has 3 birds, 3 clouds, 2 chars between dashes, the water at the lowest level, and the boat on the far left we can tell that the date is Wednesday March 2nd, and the time is 1:00pm.

Here is another example from Sunday April 25th, at 3:58am:

 ________________________________________________________________
|\ ____________________________________________________________ /|
| |                                                            | |
| |                                                     * *    | |
| |                            *       *                 *     | |
| |               *                                            | |
| |                                                            | |
| |                           *                                | |
| |         *                      *                           | |
| |                                                            | |
| |                                 *                          | |
| |                                                            | |
| |                                 *                          | |
| |  _                                                         | |
| | /|\                          *                             | |
| |/ | \                                                       | |
| |__|__\                                                     /| |
| |__|____                                                   __| |
| |______/~~~~~~~~~~~~~~~~~~~-~~~~~~~~~~~~~~~~~~~~~~~~~-~~~~~\_| |
| |                                                            | |
| |                                                            | |
| |____________________________________________________________| |
|/______________________________________________________________\|

Goal

Your goal is to write the shortest program possible that outputs these ASCII art "calendars" to stdout using the time when the program is run.

Every run of the program should output one time-scene. Updates should not be automatic (or animated).

The clouds, stars, and birds, should be placed randomly in the sky (so every run, even ones at the same time are likely to be different). They should never overlap the boat or each other. (Also the water dashes should not overlap the boat hull.)

Notice that nothing I have described appears underwater. This is for you to do. During one predetermined hour of every week (your choice), something interesting should be drawn underwater. It could be a sea monster or sunken ship or anything, it's up to you. During that hour you may even alter the design of the rest of the scene (staying in the frame bounds).

Scoring

This is a code-golf popularity-contest combo.

Your score is (bytes in program) - 4 * (upvotes - downvotes). The lowest score wins.

Use http://mothereff.in/byte-counter as a byte counter if you use non-ASCII characters.

Notes and Updates

  • You may use buoys instead of dashes, since, lets face it, they're much more appropriate:

       |     |
    ~~(_)~~~(_)~~ (3rd of the month)
    
  • The dashes (or buoys) do not have to be random but it would be nice if they were.

  • Your "special hour" should last 60 minutes from the top of the hour to 1 minute before the next hour.
  • During the special hour the things you draw underwater may move and may alter the surface and the sky when it makes sense (e.g. sea monster eating the boat, black hole forming at the sea floor, etc.)
\$\endgroup\$
  • 21
    \$\begingroup\$ Would it be wrong of us to start downvoting all your questions/answers until you are back under 4k so you can continue posting awesome questions? \$\endgroup\$ – Kyle Kanos Aug 12 '14 at 2:10
  • 4
    \$\begingroup\$ This seems like something used by Cold War spies to secretly communicate meeting times. \$\endgroup\$ – NinjaBearMonkey Aug 12 '14 at 2:51
  • 3
    \$\begingroup\$ Why not two buoys instead of dashes ? They'd be more visible and less out-of-place :) " |>\n~(_)~\n °" \$\endgroup\$ – Quentin Aug 12 '14 at 10:18
  • 4
    \$\begingroup\$ 1. Yes please do dump any excess ideas in the sandbox \$\endgroup\$ – trichoplax Aug 12 '14 at 22:10
  • 7
    \$\begingroup\$ 2. Every so often, drop back in unexpectedly like a creature of myth \$\endgroup\$ – trichoplax Aug 12 '14 at 22:11
21
\$\begingroup\$

Ruby, At World's End, 1260 1070 967 bytes

Anyone remember that Pirates of the Caribbean film?

c=("   #{?_*60}   
")*2
c+="| |#{' '*60}| |
"*19+c
[67,132,-2,-66,-67,-69,-71,-132,-134].map{|i|c[i]=?|}
a=c[68]=c[-3]=?\\
e=c[131]=c[-66]=?/
[1,2,-4,-65,63,64].map{|i|c[i]=?_}
t=Time.now
w,_,n,l,d,m=t.wday,*t.to_a
p=l>11
q=(l-1)%12+1
h=(20-(l-1)%12)*67+3
c[h,60]=?~*60
f=(n+9)%60
f=f+d>58?n>d+2?0:n-12:f
c[h+f]=c[h+f+d+1]=?-
s=l==18&&w==0
z=->s{s.chars.map(&:to_i)}
b={?_=>z['5410110125'+g='020304050607121315161718222326'],e=>z['08213243'],a=>z['00273645'],?|=>z['14243444'],?#=>[3,3,3,5]}
b={?_=>z[g+'272855140824'].map{|i|i-1},a=>b[e],e=>b[a],?|=>z['142434']}if s
b.each{|k,v|v.each_slice(2){|j,i|c[h-67*j*(s ?-1:1)+(i+n)%60]=k}}
r=->(m,t){k=0
(x=rand(53)
y=rand(19-q)
m.values.flatten.each_slice(2).any?{|j,i|c[h-(y+j)*67+i+x]!=' '}? next: m.each{|k,v|v.each_slice(2){|j,i|c[h-(y+j)*67+i+x]=k}}
k+=1)while k<t}
r[{?(=>[1,0,2,2],?)=>z['141726'],?_=>z['111213151621333435'],?#=>z['232425']},w]
r[l>5&&l<18?{?-=>[1,0,1,2],?.=>[1,1]}:{?*=>[1,0]},m]
puts c.tr(?#,' ')

There's still a lot of room for improving the golfitude there, but it's a start.

Now what's with the movie reference? Apparently that Green Flash happens a lot more often than Jack Sparrow wants us to believe. In fact, it happens about once a week instead of once every ten years. Every Sunday at sunset, the Black Ruby (hrhr) does one round in the land of the dead:

 ________________________________________________________________
|\ ____________________________________________________________ /|
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| | *                          *                       *       | |
| |                     *                            *         | |
| |         *  *                  *             _______        | |
| |-~~~~~~~~~~~~-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/_______\~~~~~~~| |
| |                                             ___|___        | |
| |                                             \  |  /        | |
| |                                              \ | /         | |
| |                                               \_/          | |
| |                                                            | |
| |____________________________________________________________| |
|/______________________________________________________________\|
\$\endgroup\$
13
\$\begingroup\$

Java - Cute Kraken (A lot of bytes)

EDIT: Further improvements to birds/stars bring up top and clouds, now the most busy calendar (12pm, Saturday, December) works about 70% of the time. Other 30% I get a (get ready for this) Stack Overflow error because I use recursion. New pics of busiest possible calendar and new Kraken pic, which shows off the lows/highs of stars/clouds.

Now better handles situations in which the random scattering of stars/birds prevents the random insertion of clouds. When things are too crowded and it doesn't work after 200 tries, we re-do the stars/birds in hopes that the next configuration will allow the clouds some personal space.

Who's a cute wittle kwaken? Who's a cute wittle kwaken? You are! You are!

Minor edits, still no golfing. Kwaken shows up on the 9s because he knows everyone expects him at midnight. He's small and shy now, but one day he hopes to eat the ship.

Clouds have a tendency to be low in the sky, while stars and birds like to fly above them; things tend to get a little crowded around 8 o'clock though.

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class TimeFlies
{
   static char[][] frame = new char[23][66];
   static char[] bird = new char[] {'-', '.', '-'};
   static char[][] boat = new char[][]{
   {' ', ' ', ' ', ' ', '_', ' ', ' ', ' ', ' '}, 
   {' ', ' ', ' ', '/', '|', '\\', ' ', ' ', ' '},
   {' ', ' ', '/', ' ', '|', ' ', '\\', ' ', ' '},
   {' ', '/', '_', '_', '|', '_', '_', '\\', ' '},
   {'_', '_', '_', '_', '|', '_', '_', '_', '_'},
   {'\\', '_', '_', '_', '_', '_', '_', '_', '/'},
   };
   static char[][] cloud = new char[][]{
   {' ', ' ', ' ', '_', '_', '_', ' ', ' '},
   {' ', '_', '(', ' ', ' ', ' ', ')', ' '},
   {'(', '_', '_', '_', ')', '_', '_', ')'},
   };
   static char[][] kraken = new char[][]{
   {' ', ' ', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', ' ', ' ', ' '},
   {' ', ' ', '/', ' ', ' ', '_', ' ', ' ', ' ', '_', ' ', '\\', ' ', ' ', ' '},
   {' ', '|', ' ', ' ', '|', '_', '|', ' ', '|', '_', '|', ' ', '|', ' ', ' '},
   {' ', ' ', '\\', '_', '_', '_', '\\', ' ', '/', '_', '_', '/', ' ', ' ', ' '},
   {' ', ' ', ' ', '/', '|', ' ', '|', ' ', '|', ' ', '|', '\\', ' ', ' ', ' '},
   {'_', '_', '/', ' ', '|', ' ', '|', ' ', '|', ' ', '|', ' ', '\\', '_', '_'},
   {' ', ' ', '_', '/', ' ', ' ', '|', ' ', '|', ' ', ' ', '\\', '_', ' ', ' '},
   {' ', ' ', ' ', ' ', ' ', '/', ' ', ' ', ' ', '\\', ' ', ' ', ' ', ' ', ' '}}; 

   static int day, month, hours, minutes, weekday, attempts = 0;
   static boolean isFirstTime, birds = true;
   static String timeStamp;

   public static void main()
   {
       timeStamp = new SimpleDateFormat("MMddHHmm").format(Calendar.getInstance().getTime());
       isFirstTime = true;
       retry();
   }

   public static void retry()
   {

       day = Integer.parseInt(timeStamp.substring(2, 4));
       month = Integer.parseInt(timeStamp.substring(0, 2));
       hours = Integer.parseInt(timeStamp.substring(4, 6));
       minutes = Integer.parseInt(timeStamp.substring(6, 8));

       Calendar c = Calendar.getInstance();
       c.set(2014, month, day);
       weekday = c.get(Calendar.DAY_OF_WEEK) - 1; 

       int timeTemp = hours*60 + minutes;
       if(timeTemp < 360 || timeTemp > 1080)
       {
           birds = false;
           month *= 3;
       }
       if(hours > 12) 
           hours -= 12;
       initiateFrame();

       if(isFirstTime)
       {
           printFrame();
           isFirstTime = false;
       }
   }

   public static void insertStuff()
   {
       for(int i = 0; i < boat.length; i++)
           for(int k = 0; k < boat[0].length; k++)
           {
               if(3+k+minutes > 62)
                   frame[15 + i - hours][3 + k + minutes-60] = boat[i][k];
               else
                   frame[15 + i - hours][3 + k + minutes] = boat[i][k];
           }

       boolean beganDayCount = false;
       for(int i = 0; i <= 22; i++)
           for(int k = 0; k <=65; k++)
               if(i == (20 - hours) && (k > 2 && k < 63) && frame[i][k] == ' ')
               {
                   if(!beganDayCount)
                   {
                       frame[i][k] = '-';
                       beganDayCount = true;
                   }
                   else 
                   {
                       if(day > 0)
                           frame[i][k] = '~';
                       if(day == 0)
                           frame[i][k] = '-';
                       else
                           frame[i][k] = '~';
                       day--;
                   }
               }
       putInBirdsOrStars();
       putInClouds();
       if(hours == 9)
           putInKraken();
   }

   public static void putInKraken()
   {
       for(int i = 0; i < kraken.length; i++)
           for(int k = 0; k < kraken[0].length; k++)
               frame[i + 12][k + 20] = kraken[i][k];
   }

   public static void putInClouds()
   {
       int x = (int)(Math.random() * 7) + (14-hours);
       int y = (int)(Math.random() * 54) + 2;
       boolean noFreeSpace = true;

       for(int i = 0; i < cloud.length; i++)
       {
           for(int k = 0; k < cloud[0].length; k++)
           {
               if(frame[x + i][y + k] == ' ' )
                   noFreeSpace = false;
               else
               {
                   noFreeSpace = true;
                   break;
               }
           }
           if(noFreeSpace)
               break;
       }

       if(x + 2 > 20 - hours)
           noFreeSpace = true;

       if(!noFreeSpace)
       {
           for(int i = 0; i < cloud.length; i++)
               for(int k = 0; k < cloud[0].length; k++)
                   frame[x + i][y + k] = cloud[i][k];
           weekday--;
       }

       attempts++;
       if(attempts > 200)
       {
           attempts = 0;
           retry();
       }
       if(weekday > 0)
           putInClouds();
   }

   public static void putInBirdsOrStars()
   {
       int x = (int)(Math.random() * 5) + (12 - hours);
       int y = (int)(Math.random() * 60) + 2;
       boolean freeSpace = false;

       for(int i = 0; i < bird.length; i++)
           if(frame[x][y] == ' ' && frame[x][y + 1] == ' ' && frame[x][y + 2] == ' ')
               freeSpace = true;

       if(x > 20- hours)
           freeSpace = false;
       if(birds && freeSpace)
       {
           for(int i = 0; i < bird.length; i++)
               frame[x][y++] = bird[i];
           month--;
       }
       else if(freeSpace)
       {
          frame[x][y] = '*';
          month--;
       }
       if(month > 0)
           putInBirdsOrStars();
   }

   public static void initiateFrame()
   {
       for(int i = 0; i <= 22; i++)
           for(int k = 0; k <=65; k++)
           {
               if(((k == 0 || k == 65) && (i > 0)) || ((k == 2 || k == 63) && (i > 1 && i < 22)))
                   frame[i][k] = '|';
               else if((i == 0 && (k > 0 && k < 65)) || ((i == 1 || i == 21) && (k > 2 && k < 63)) || (i == 22 && (k > 1 && k < 64)))
                   frame[i][k] = '_';
               else
                   frame[i][k] = ' ';
           }

       frame[1][1] = '\\'; frame[1][64] = '/'; frame[22][1] = '/';frame[22][64] = '\\';
       insertStuff();
   }        


   public static void printFrame()
   {
       for(int i = 0; i <= 22; i++)
       {
           for(int k = 0; k <=65; k++)
               System.out.print(frame[i][k]);
           System.out.println();
       }
   }
}

Casual output

 ________________________________________________________________  
|\ ____________________________________________________________ /| 
| |                                                      -.-   | | 
| |                                   -.-                      | | 
| |                                                            | | 
| |      -.-                                                   | | 
| |                                                            | | 
| |               -.-                                          | | 
| |                                                            | | 
| |                     -.-                           -.-      | | 
| |    -.-                                  ___                | | 
| |            -.-                        _(   )      ___      | | 
| |             ___                      (___)__)   _(   )     | | 
| |           _(   )        ___               _    (___)__)    | | 
| |          (___)__)     _(   )             /|\               | | 
| |     ___              (___)__)   ___     / | \              | | 
| |   _(   )                      _(   )   /__|__\             | | 
| |  (___)__)                    (___)__) ____|____            | | 
| |-~~~~~~~~~~~~~-~~~~~~~~~~~~~~~~~~~~~~~~\_______/~~~~~~~~~~~~| | 
| |                                                            | | 
| |                                                            | | 
| |____________________________________________________________| | 
|/______________________________________________________________\| 

super busy output

 ________________________________________________________________ 
|\ ____________________________________________________________ /|
| |  *  * **    * *        *  *    **       * *   *    * *  *  | |
| |*  _   *  *       **  *        *         *   *  *      *    | |
| |  /|\*    ___  *  **  *     *        *      ___  *     *    | |
| | / | \  _(   )    ___      ___       ___  _(   )    ___     | |
| |/__|__\(___)__) _(   )   _(   )    _(   )(___)__) _(   )    | |
| |___|____       (___)__) (___)__)  (___)__)       (___)__)  _| |
| |_______/-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-~~~~~~~~~~~~~~~~~~~\| |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |____________________________________________________________| |
|/______________________________________________________________\|

If we're to introduce our kraken by hard coding some values, we get...

 ________________________________________________________________ 
|\ ____________________________________________________________ /|
| |                                                            | |
| |*           *  *     *                                   *  | |
| |  *       *                                    *   *   *    | |
| |*          ___      *  *                   *    *           | |
| |         _(   )  _         ___      *   *                   | |
| |     *  (___)__)/|\*     _(   )  *   *    *   ___   *   *   | |
| |   ___         / | \    (___)__)   ___      _(   )    ___   | |
| | _(   )       /__|__\            _(   )    (___)__) _(   )  | |
| |(___)__)     ____|____          (___)__)           (___)__) | |
| |-~~~~~~~~~~~~\_______/~~~-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| |
| |                    ________                                | |
| |                   /  _   _ \                               | |
| |                  |  |_| |_| |                              | |
| |                   \___\ /__/                               | |
| |                    /| | | |\                               | |
| |                 __/ | | | | \__                            | |
| |                   _/  | |  \_                              | |
| |                      /   \                                 | |
| |                                                            | |
| |____________________________________________________________| |
|/______________________________________________________________\|
\$\endgroup\$
  • 5
    \$\begingroup\$ Love that Squidward-like Kraken) \$\endgroup\$ – Somnium Aug 14 '14 at 13:15
11
\$\begingroup\$

Python3 - Pirates and Jellyfish: 1580 1472 bytes

Every Wednesday at midnight a pirate ship sinks our boat. The noise wakes up a giant jellyfish who randomly roams the frame for an hour.

from random import*
from datetime import*
l=len;r=range
n=randint
def f(s,p,*a):
 global c,o;j=l(s[0])
 while 1:
  x=n(3,63-j);y=n(3,p);g=y+l(s);h=x+j
  if not(o[y][x]or o[g][h]or o[g][x]or o[y][h]):break
 if l(a)!= 0:x,y=a
 for w in r(l(s)):
  for m in r(j):c[y+w][x+m]=s[w][m];o[y+w][x+m]=1
E=datetime.now();D=(E.weekday()+1)%7
h=E.hour;M=E.month
t=6<h<18;N=(3*M,M)[t]
H=9if h==0 else 21-h%12
s=min(H-1,12)
o=[[0]*66 for i in r(23)]
c=[['']*66 for i in r(23)]
c[0]=[' ']+['_']*64+[' ']
c[1]=['|','\\']+['_']*62+['/','|']
for i in r(2,21):c[i]=['|',' ','|']+[' ']*60+['|',' ','|'] 
c[21]=['|',' ','|']+['_']*60+['|',' ','|']
c[22]=['|','/']+['_']*62+['\\','|']
for i in r(3,63):c[H][i]='~'
Z=(D!=3or h!=0)
B=(['    _~_      ','  __)__)__   ','  )_))_))_)  ','.--:--:--:-=/',' \\_o__o__o_/ '],['    _    ','   /|\\   ','  / | \  ',' /__|__\\ ','____|____','\\_______/'])[Z]
j=l(B[0]);y=H-l(B)+1;x=E.minute 
while 1:
 b=n(3,63)
 if b<x or b>(x+j):break
z=E.day+1;d=b+z
if b<x<d:d+=j
if d>63:d=b-z
if d<x<b:d-=j
c[H][b]=c[H][d]='-'
for w in r(l(B)):
 for m in r(j):
  g=x+m;k=y+w
  if g>59:c[k][g-57]=B[w][m];o[k][g-57]=1
  else:c[k][g+3]=B[w][m];o[k][g+3]=1
f((["  ,'',  ",".°____°."," :::::: ",",';:::'."," ,';:'. "],[''])[Z],s,n(3,50),n(10,13))
f((['  o  ° o °','°________°','/___°____\\'],[''])[Z],s,15,18)
for i in r(D):f(['   ___  ','  (   ) ','(___)__)'],s-3)
for i in r(N):f(('*',['-.-'])[t],s)
for w in r(23):
 for m in r(66):print(c[w][m],end='')
 print('')

Example at Tuesday Aug 19 23:27

enter image description here

On Wednesdays around midnight:

enter image description here

\$\endgroup\$
6
\$\begingroup\$

Cobra - 994

Without Bouys: 994

class P
    def main
        r,d=Random(),DateTime.now
        h,y,t,a=(d.hour+23)%24+1,d.day,d.month,d.dayOfWeek to int
        u,i,q=18-(h-1)%12,List<of String>[](20),1-(h+7)%24//13
        for p in 20
            i[p],s=['| |\n'],'__'
            for x in 60,i[p],s=[if(p-u,'[' _'[p//19]]','~')]+i[p],s+'_'
        for g in 6,for c in 9,i[u-g][(d.minute+c)%60]='[r'\_______/____|____ /__|__\   /#|#\     /|\       _    '[g*9+c]]'
        while x,if'~'==i[u][p-=p-r.next(60-y)]==i[u][p+y+1],i[u][p],i[u][p+y+1],x='-','-',0
        while g+c
            o,c,g=i,a,t+t*q*2
            for z in 99,if if(c,o[y-=y-r.next(u-2)][x-=x-r.next(52):x+8]+o[y+1][x:x+8]+o[y+2][x:x+8],o[y-=y-r.next(u)][x-=x-r.next(60-3+3*q):x+4-3*q]).join('').trim==''and g,for m in 3-(p-=p-if(c,0,1))*2,for n in 8-p*5,o[y+m][x+n-p*n*q],c,g=if(c,'['   ___   _(###) (___)__)'[m*8+n]]',['['-.-'[n]]','*'][q]),c-(m+n)//9,g-p*n//2
        print' _[s]_ \n|\\[s]/|'
        for l in o,for k in['| |']+l
            Console.foregroundColor=if(k<>'~'or h+a>1,7,9)to ConsoleColor
            Console.write(if(k=='#',' ',k))
        print'|/[s]\\|'

With Bouys: 1084

class P
    def main
        r,d=Random(),DateTime.now
        h,y,t,a=(d.hour+23)%24+1,d.day,d.month,d.dayOfWeek to int
        u,i,q=18-(h-1)%12,List<of String>[](20),1-(h+7)%24//13
        for p in 20
            i[p],s=['| |\n'],'__'
            for x in 60,i[p],s=[if(p-u,'[' _'[p//19]]','~')]+i[p],s+'_'
        for g in 6,for c in 9,i[u-g][(d.minute+c)%60]='[r'\_______/____|____ /__|__\   /#|#\     /|\       _    '[g*9+c]]'
        while x<>3,if''==(i[u][p-=p-r.next(58-y):p+3]+i[u][p+y+3:p+y+7]).join('').trim(c'~')
            i[u-1][p+1]=i[u-1][p+y+4]='|'
            for x in 3,i[u][p+x]=i[u][p+y+3+x]='['(_)'[x]]'
        while g+c
            o,c,g=i,a,t+t*q*2
            for z in 99,if if(c,o[y-=y-r.next(u-2)][x-=x-r.next(52):x+8]+o[y+1][x:x+8]+o[y+2][x:x+8],o[y-=y-r.next(u)][x-=x-r.next(60-3+3*q):x+4-3*q]).join('').trim==''and g,for m in 3-(p-=p-if(c,0,1))*2,for n in 8-p*5,o[y+m][x+n-p*n*q],c,g=if(c,'['   ___   _(###) (___)__)'[m*8+n]]',['['-.-'[n]]','*'][q]),c-(m+n)//9,g-p*n//2
        print' _[s]_ \n|\\[s]/|'
        for l in o,for k in['| |']+l
            Console.foregroundColor=if(k<>'~'or h+a>1,7,9)to ConsoleColor
            Console.write(if(k=='#',' ',k))
        print'|/[s]\\|'

At 1am every Sunday, the endless expanse of the tilde sea on comes alive with a dazzling blue shine. Hope returns to the people of the desolate shell-world.

enter image description here

\$\endgroup\$
5
\$\begingroup\$

C# 1124 1128bytes

Once a week, a shoddy ASCII submarine should appear for an hour below the waterline, and increase my byte count noticeably hopefully this code will actually work now. I dread to think what happens on Saturdays at 11:00 in December...

using System;class P{static string G(DateTime t){Func<int,int>K=new Random().Next;int i,j,D=t.Day,H=t.Hour,W=19-H%12,E=(int)t.DayOfWeek;var M=new char[60,19];Func<int,int,int,string,bool>T=(x,y,w,s)=>{for(i=0;i<s.Length;)if(M[(x+i%w)%60,y+i++/w]>0)return 0>1;for(;i-->0;)M[(x+i%w)%60,y+i/w]=s[i];return 1>0;};T(t.Minute,W-5,9,@"    _       /|\     / | \   /__|__\ ____|____\_______/");while(M[j=K(59-D),W]+M[j+D+1,W]>0){}M[j+D+1,W]=M[j,W]='-';for(j=60;j-->0;)T(j,W,1,"~");for(;++j<E;)while(!T(K(53),K(W-3),8,"   ___   _(   ) (___)__)")){}var N=H<6|H>=18;for(j=0;j++<t.Month*(N?3:1);)while(!T(K(60-(N?1:3)),K(W-1),3,N?"*":"-.-")){}if(H==18&E==4)T(K(59),W+2,17,@"    __            __/  \_________ (_______________)");var res=" ________________________________________________________________\n|\\ ____________________________________________________________ /|\n| |";for(j=0;j<19;j++){for(i=0;i<60;i++)res+=M[i,j];res+="| |\n| |";}return res+"____________________________________________________________| |\n|/______________________________________________________________\\|";}static void Main(){Console.Write(G(DateTime.Now));}}

Somewhat formatted code (which re-draws every 15seconds because I mis-read the spec):

using System;

class P
{
    static string G(DateTime t)
    {
        Func<int,int>K=new Random().Next;
        int i,j,D=t.Day,H=t.Hour,W=19-H%12,E=(int)t.DayOfWeek;
        var M=new char[60,19];

        Func<int,int,int,string,bool>T=(x,y,w,s)=>
        {
            for(i=0;i<s.Length;)
                if(M[(x+i%w)%60,y+i++/w]>0)
                    return 0>1;
            for(;i-->0;)
                M[(x+i%w)%60,y+i/w]=s[i];
            return 1>0;
        };

        T(t.Minute,W-5,9,@"    _       /|\     / | \   /__|__\ ____|____\_______/");

        while(M[j=K(59-D),W]+M[j+D+1,W]>0){}
        M[j+D+1,W]=M[j,W]='-';

        for(j=60;j-->0;)
            T(j,W,1,"~");

        for(;++j<E;)
            while(!T(K(53),K(W-3),8,"   ___   _(   ) (___)__)")){}

        var N=H<6|H>=18;
        for(j=0;j++<t.Month*(N?3:1);)
            while(!T(K(60-(N?1:3)),K(W-1),3,N?"*":"-.-")){}

        if(H==18&E==4)
            T(K(59),W+2,17,@"    __            __/  \_________ (_______________)");

        var res=@" ________________________________________________________________
|\ ____________________________________________________________ /|
| |";

        for(j=0;j<19;j++)
        {
            for(i=0;i<60;i++)
                res+=M[i,j];
            res+="| |\n| |";
        }

        return res+@"____________________________________________________________| |
|/______________________________________________________________\|";
    }

    static void Main()
    {
        for(;;)
        {
            Console.Clear();
            Console.Write(G(DateTime.Now));
            System.Threading.Thread.Sleep(15000);
        }
    }
}

Example output (should read 3:31, Wednesday, 13th August):

 ________________________________________________________________
|\ ____________________________________________________________ /|
| |                                                            | |
| |         *  *                                               | |
| |                         *                                  | |
| |      *                 *                                   | |
| |                     *                                      | |
| |            ___                        * *                  | |
| |          _(   )                                            | |
| |        *(___)__)      *                   *                | |
| |                                  *                         | |
| |           ___    *                                      *  | |
| |     *   _(   )  *                             ___    *     | |
| |      * (___)__)                   _         _(   )         | |
| |        *             *           /|\       (___)__)  *  *  | |
| |                                 / | \     *           *    | |
| |                                /__|__\                     | |
| |                               ____|____                    | |
| |~~-~~~~~~~~~~~~~-~~~~~~~~~~~~~~\_______/~~~~~~~~~~~~~~~~~~~~| |
| |                                                            | |
| |                                                            | |
| |____________________________________________________________| |
|/______________________________________________________________\|
\$\endgroup\$
3
\$\begingroup\$

Lua - more than stars

I'm done!

Well, not done done. I'm done with this code and challenge. It's not golfed, it's missing the month indicator. There's no avoidance... I'm only posting it so that in the off chance nobody completes this chalange, at least you saw something, got an idea.

--Halfed Assed Calender
math.randomseed(os.time())
math.randomseed(os.time())
math.randomseed(os.time())
local bh=os.date("%I")
local bm=os.date("%m")
local wdm=os.date("%d")
local cdw=os.date("%w")
local bsm=os.date("%M")
local hh=tonumber(os.date("%H"))
local function tp(t)
    for i=1,#t do
        for k= 1, #t[i] do
            io.write(t[i][k])
        end
        print()
    end
end

local function s2a(s)
    local ns = {}
    for i=1, table.getn(s) do
        local nns={}
        for k = 1, string.len(s[i]) do
            table.insert(nns, string.sub(s[i],k,k))
        end
        table.insert(ns,nns)
    end
    return ns
end



function ca(bg, a, x,y)
    ntb={} lbg=#bg la=#a lax=#a[1] lbgx=#bg[1]
    if lbgx-((lax+y)-1)<0 then
    elseif lbg-((la+x)-1)<0 then
    else
        for i=1,la do
            for j = 1, lax do
                if " "==a[i][j] then
                else
                    table.remove(bg[x+(i-1)],y+(j-1))
                    table.insert(bg[x+(i-1)],y+(j-1), a[i][j])
                end
            end
        end
    end
    return bg
end
f=s2a({" ________________________________________________________________ ","|\\ ____________________________________________________________ /|","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |                                                            | |","| |____________________________________________________________| |","|/______________________________________________________________\\|"})
boat=s2a({"    _    ","   /|\\     ","  / | \\   "," /__|__\\  ","____|____ ","\\_______/  "})
ccc=s2a({"   ___  "," _(   ) ","(___)__)"})
water=s2a({"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"})
tblock=s2a({"xxx","xxx","xxx"})
temp=ca(f,water,19-bh,4)
if hh<18 and hh>= 6 then
    n=bm sb = {{"-",".","-"}}
else
    n=3*bm sb={{"*"}}
end

for i = 1,n do
    r1=math.random(14 -bh)
    r2=math.random(59)
    temp=ca(temp,sb,r1+3,r2+3)
end
if cdw==0 then
else
    for i=1,cdw do
        r1=math.random(11-bh)
        r2=math.random(52)
        temp=ca(temp,ccc,r1+3,r2+3)
    end
end
temp=ca(temp,boat,14-bh, bsm)
tp(temp)

You can take look at it here.


|\ ____________________________________________________________ /|
| |                                                            | |
| |       -.-                                                  | |
| |                                                            | |
| |                                        ___                 | |
| |                                      _(   )                | |
| |                  -.-   -.-          (___)__)               | |
| |                                                            | |
| |                            -.-             _        ___    | |
| |          -.-                              /|\     _(   )   | |
| |              -.-                         / | \   (___)__)  | |
| |                                         /__|__\ -.-.-      | |
| |                                        ____|____           | |
| |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\_______/~~~~~~~~~~~| |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |____________________________________________________________| |
|/______________________________________________________________\|
\$\endgroup\$
  • 5
    \$\begingroup\$ Adding an example output here would be good too (especially for the once a week bit). \$\endgroup\$ – trichoplax Aug 12 '14 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.