ASCII艺术日历


54

让我们制作一个ASCII艺术时钟和日历,告诉我们当前的月份,每月的某天,一周的某天,小时,分钟,以及它是夜晚还是白天(但不是年份或秒)。

在任何特定时间,日历将看起来像这样:(看起来更好,行距更少)

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

它始终是一个66 x 23字符的“相框”,其边框永远不会改变。

框架中的图像告诉我们时间和日期:

  • 在白天(6:00 am-5:59 pm),该月取决于-.-天空中的鸟类数量()。一月= 1鸟,二月= 2鸟,依此类推。
  • 在夜间(6:00 pm-5:59 am),鸟类会被3倍的星星(*)代替。一月= 3星,二月= 6星,以此类推。鸟类和星星永远不会同时出现在天空中。
  • -水上两个破折号()之间的字符数决定了该月的一天。例如,~~-~~~~-~~表示这是该月的第四天。根据分钟的不同,船可能需要位于破折号之间(破折号不会环绕)。
  • 一周中的一天取决于天空中的云彩数量(所有云彩看起来都一样)。星期日= 0云,星期一= 1云,...,星期六= 6云。
  • 小时取决于水(和船)的水位。在最低点(如上)是1点,在2点是1个字符高,依此类推,直到12点,然后回到1点。(这是12而不是24小时制。)
  • 分钟由船的水平位置确定。凌晨时分,船触及车架的左边缘(如上所述)。随后的每一分钟,船向右移动一个字符。在第51至59分钟内,它从框架的右侧循环回到左侧。

因此,假设上面的示例有3鸟,3云,虚线之间有2个字符,最低水位和最左边的船,我们可以说出日期是3月2日,星期三:下午00点。

这是4月25日星期日凌晨3:58的另一个示例:

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

目标

您的目标是编写最短的程序,并使用该程序运行的时间将这些ASCII艺术“日历”输出到stdout。

程序的每次运行都应输出一个时间场面。更新不应是自动的(或动画的)。

云,星和鸟应该随机地放置在天空中(因此,每次运行,即使同时运行,也可能会有所不同)。他们不应该重叠船或彼此。(此外,破折号不应与船体重叠。)

请注意,我所描述的东西都没有出现在水下。这是您要做的。在每周预定的一个小时内(您的选择),应该在水下绘制一些有趣的东西。可能是海怪,沉船或其他任何东西,由您决定。在那一小时内,您甚至可以更改场景其余部分的设计(停留在框架范围内)。

计分

这是一个代码高尔夫受欢迎度竞赛组合。

你的分数是(bytes in program) - 4 * (upvotes - downvotes)。最低分获胜。

如果您使用非ASCII字符,请使用http://mothereff.in/byte-counter作为字节计数器。

注释和更新

  • 您可以使用浮标而不是破折号,因为让我们面对现实,它们更合适:

       |     |
    ~~(_)~~~(_)~~ (3rd of the month)
    
  • 破折号(或浮标)不必一定是随机的,但如果是随机的,那将是很好的。

  • 您的“特殊时间”应持续时间从小时顶部的60分钟到下一个小时的1分钟。
  • 在特殊的时间段内,您在水下绘制的东西可能会移动,并且在合理的时候可能会改变表面和天空(例如,海怪正在吃船,海底形成黑洞等)。

21
我们开始对您的所有问题/答案投反对票,直到您回到4k以下,这样您才可以继续发表很棒的问题吗?
凯尔·坎诺斯

4
这似乎是冷战间谍用来秘密传达会议时间的东西。
NinjaBearMonkey 2014年

3
为什么不用两个浮标代替破折号?它们会更加可见,而不会错位:)“ |> \ n〜(_)〜\ n°”
Quentin 2014年

4
1.是的,请不要将任何多余的想法
丢到

7
2.每隔一段时间,就像神话中的生物一样意外地掉回来
trichoplax

Answers:


21

Ruby,在世界尽头1260 1070 967字节

有人记得加勒比海盗电影吗?

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(?#,' ')

那里仍有许多改善高尔夫运动的空间,但这是一个开始。

现在电影参考是什么?显然,绿色闪光的发生频率比杰克·斯派洛(Jack Sparrow)所希望的要多。实际上,它大约每周一次而不是十年一次。每个日落的星期日,黑宝石(hrhr)在死者的土地上进行一轮:

 ________________________________________________________________
|\ ____________________________________________________________ /|
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| |                                                            | |
| | *                          *                       *       | |
| |                     *                            *         | |
| |         *  *                  *             _______        | |
| |-~~~~~~~~~~~~-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/_______\~~~~~~~| |
| |                                             ___|___        | |
| |                                             \  |  /        | |
| |                                              \ | /         | |
| |                                               \_/          | |
| |                                                            | |
| |____________________________________________________________| |
|/______________________________________________________________\|

13

Java-可爱的海妖(很多字节)

编辑:对鸟类/星星的进一步改进可以使顶部和云彩更加明亮,现在最繁忙的日历(12月,星期六,12月)是大约70%的时间工作。其他30%的人由于使用递归而收到(为此做好准备)堆栈溢出错误。最繁忙的日历的新图片和新的海妖图片,这些图片展示了星星/云的低点/高点。

现在可以更好地处理星/鸟的随机散射阻止云的随机插入的情况。当事情过于拥挤,经过200次尝试后无法正常工作时,我们重新做星星/鸟,希望下一个配置可以让云层有一些个人空间。

谁是个可爱的小智者?谁是个可爱的小智者?你是!你是!

较小的修改,仍然没有打高尔夫球。夸肯(Kwaken)出现在9年代,因为他知道每个人都在午夜期待他。他现在很小又害羞,但是有一天他希望吃掉这艘船。

云层倾向于低空飞行,而星星和鸟类则喜欢在云层之上飞翔。不过,在8点左右,事情往往会变得有些拥挤。

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();
       }
   }
}

随意输出

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

超级忙输出

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

如果我们要通过对一些值进行硬编码来介绍我们的海妖,我们将得到...

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

5
喜欢像乌贼一样的海妖
Kaken

11

Python3-海盗和水母:1580 1472字节

每个星期三的午夜,海盗船都会下沉我们的船。噪音唤醒了一只巨大的水母,他随机在镜架上漫游了一个小时。

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('')

例如8月19日星期二23:27

在此处输入图片说明

在每周三午夜:

在此处输入图片说明


6

眼镜蛇-994

没有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]\\|'

与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]\\|'

每个星期日的凌晨1点,波涛汹涌的大海在无穷无尽的大海中绽放着璀璨的蓝色光芒。希望重返了荒凉的空壳世界。

在此处输入图片说明


5

C#1124 1128字节

每周一次,一个伪劣的ASCII潜水艇应该在吃水线下方出现一个小时,并明显增加我的字节数,希望该代码现在可以实际工作。我不敢想12月的周六11:00会发生什么...

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));}}

某种格式的代码(由于我误读了规范,每15秒重新绘制一次):

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);
        }
    }
}

输出示例(应为8月13日,星期三,3:31):

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

3

Lua-不仅仅是星星

我受够了!

好吧,还没完成。我已经完成了这段代码和挑战。它没有打高尔夫球,缺少月份指示器。不可避免,我只是发布它,以使偶然的机会没人能完成这个挑战,至少您看到了一些想法。

--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)

你可以在这里看看


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

5
在此处添加示例输出也将很好(尤其是每周一次)。
trichoplax
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.