XKCD日历事实


17

启示。经许可张贴。

打印可能的XKCD日历“事实”之一:

XKCD日历事实

您可以从我的APL参考实现Explain XKCD的成绩单(包括插图下方的标题文本)中获取原始文本和结构。

规则

在每个决策节点,每个选择都必须有相等的(伪)随机机会。

您可以全部使用大写字母。

您必须生成三个句子;问题,原因和标题文字。

三句话应被结束?.以及.分别与由单个空间彼此分离。

您可能包括的唯一额外空白是一个尾随空格和/或换行符。

例子

Did you know that the Latest Sunset drifts out of sync with the Zodiac because of time zone legislation in Indiana? Apparently it's getting worse and no one knows why. While it may seem like trivia, it has to be corrected for by GPS satellites.

Did you know that Leap Year happens later every year because of precession of the equator? Apparently scientists are really worried. While it may seem like trivia, it is taken advantage of by high-speed traders.

Did you know that Easter drifts out of sync with the atomic clock in Colorado because of a decree by the pope in the 1500s? Apparently scientists are really worried. While it may seem like trivia, it causes huge headaches for software developers.


@Rod我从没说过图表。我说是从参考实现(包括它)或从Explain XKCD(带有注释以包括标题文本)中获取文本。
亚当

输出中是否允许前导空格?
暴民埃里克(Erik the Outgolfer)'17年

@EriktheOutgolfer号
亚当


Did you know that shark week happens at the wrong time every year because of an arbitrary decision by Benjamin Franklin? Apparently it causes a predictable increase in car accidents.我...我的意思是...我...好吧
魔术章鱼缸

Answers:


7

Befunge-93,1959年,1930个字节

"#~$}%|&{'zwy#x$-#w$v%u&tTs*-#r$q%p&oTn0m1l2kpj#-#i$h%gFf(e)-#d#c$bC-'a(`)_*E+"v
v"#*_?F@%A$B#C3DYE,F+G*-TH&I%J$K#L$M#-'NCO$P#Q#RjSFT%U$V#-<W;-cX(Y'Z&[%\$]#^cF"<
>">$=%<#;$:%9F$*8+-#7$6C5/4#3$-C23-#1$0C*#/$.C$:-#,$+C*#)$(C$A'#&$%C$J#"75*-0\:v
$::"P"vv-*84:-*57$$_1-\1+::"P"%\v>+>\1-:v>-#1:#$>#\_:$#<$:#v_".",@v/"P"\%"P"::\_
>\#%4#<3g/7+g"!"-:!^!:\,g+7/"P"<<^1?<*2\_$\%1++64*g48*-^<<<>75*-0v>7+g84*-+\1-:^
#<<<*2\>#$$:0\`#$_\$55++:64*g48*-90^https://xkcd.com/1930/^<<<<<<>#\\:#< >#<>#<^

3Did you know that %the %fall'spring) equinox'winter'summer" )solstice)Olympics!
)earliest'latest(sunrise'sunset0daylight saving"s& time&leap $day%year'Easter(ha
rvest&super&blood& moon3Toyota Truck Month+Shark Week)happens (earlier&later2at
the wrong time, every year=drifts out of sync with the $sun%moon'zodiac*Gregoria
n&Mayan&lunar'iPhone* calendar9atomic clock in Colorado'might +not happen-happen
 twice+ this year- because of :time zone legislation in (Indiana(Arizona'RussiaB
a decree by the Pope in the 1500s+precession*libration)nutation)libation-eccentr
icity*obliquity) of the -earth's axis(equator/Prime Meridian3International Date,
Mason-Dixon& Line8magnetic field reversal:an arbitrary decision by 2Benjamin Fra
nklin-Isaac Newton$FDR.? Apparently Rit causes a predictable increase in car acc
idents@that's why we have leap seconds>scientists are really worriedEit was even
 more extreme during the +Bronze Age(Ice Age+Cretacious&1990sFthere's a proposal
 to fix it, but it 2will never happen;actually make things worse7is stalled in C
ongress:might be unconstitutionalHit's getting worse and no one knows whyE. Whil
e it may seem like trivia, it Ncauses huge headaches for software developersLis
taken advantage of by high-speed tradersFtriggered the 2003 Northeast BlackoutJh
as to be corrected for by GPS satellitesRis now recognized as a major cause of W
orld War I" "# "$) (6DLTV`b$ "$&% "$&2# *B& "$&(*% *,PR& "$&2>% "$&(

在线尝试!

说明

在前三行中,我们从在堆栈上建立一种状态表开始,表示所有可能句子的图形。这些堆栈条目被成对分组,因此首先有一个字符串项,然后是一个跳转或分支。为了满足此要求,在必要时用空字符串和零长度跳转填充图形。

然后,我们的主循环从堆栈中弹出一个代表字符串项的数字开始。此数字被解释为源下部字符串表中的偏移量。字符串表本质上是一种链表,包裹在多行中以适合Befunge受限的内存空间。

输出字符串后,堆栈上的下一项是跳转或分支。如果数字小于32,则表示是跳转,我们通过从堆栈中删除那么多对项来解释。如果数字等于或大于32,则为分支,我们使用值(负32)从源最后一行的表中查找分支详细信息。

分支表中的每个条目均包含一个计数,其后是偏移量列表。一旦知道要使用哪个分支,我们就可以简单地生成一个随机数,对分支计数取模,以查找适当的偏移量。然后,将此偏移量解释为跳转,从堆栈中删除所需数量的项目。

我们重复此过程,输出一个字符串,然后执行跳转或分支,直到耗尽堆栈条目。那时,我们只需输出一个“。” 标记最后一句的结尾,然后退出。


2
URL在那里做什么?
亚当

3
@Adám我在行中间留了一些空间,并认为这是记下原始漫画的一种好方法。字节数也可以引用漫画,但这完全是巧合。
James Holderness

这出奇的快...
Egg the Outgolfer

5

Javascript(ES6),1698 1510 1506 1501字节

感谢12Me21修复了代码中的错误,该错误增加了2个字节

f=并且document.write(f())不是字节数的一部分

f=_=>eval(`"Did you know that {the {Fall;Spring} Equinox;the {Wint;Summ}er {Solstice;Olympics};the {Earli;Lat}est Sun{rise;set};Daylight Saving{;s} Time;Leap {Day;Year};Easter;the {Harvest;Super;Blood} Moon;Toyota Truck Month;Shark Week} {happens {earlier;later;at the wrong time} every year;drifts out of sync with the {Sun;Moon;Zodiac;{Gregorian;Mayan;Lunar;iPhone} Calendar;atomic clock in Colorado};might {not happen;happen twice} this year} because of {time zone legislation in {Indian;Arizon;Russi}a;a decree by the pope in the 1500s;{{precession;eccentricity;obliquity};{lib;liber;nut}ation} of the {Moon;Sun;Earth's axis;equator;prime meridian;{international date;mason-dixon} line};magnetic field reversal;an arbitrary decision by {Benjamin Franklin;Isaac Newton;FDR}}? Apparently {it causes a predictable increase in car accidents;that's why we have leap seconds;scientists are really worried;it was even more extreme during the {{Bronz;Ic}e Age;{Cretaceou;1990}s};there's a proposal to fix it, but it {will never happen;actually makes things worse;is stalled in congress;might be unconstitutional};it's getting worse and no one knows why}. While it may seem like trivia, it {causes huge headaches for software developers;is taken advantage of by high-speed traders;triggered the 2003 Northeast Blackout;has to be corrected for by GPS satellites;is now recognized as a major cause of World War I}."`.split`{`.join`"+(a=>a[Math.random()*a.length|0])(["`.split`}`.join`"])+"`.split`;`.join`","`)
document.write(f())


4

Python 2,1297字节

-419字节,多亏了ovs。

exec'eJxNVcGO3DYMvecriLk4m2yCSYseUqAomgYpcgkW7WHPtMSxmZElR5Jnxvv1fZQns3sybZHi4+MjfchposzR46HTnHJ988r9EXjqPb/h392Y1Mlrvns1Z421+6ye1rTQMaYz1ZErdW/d666OshkHDqG774p5D93d247kx6IxXfDx5nTGTZLNbZkmGObWDkoKpSIfjlJYp1ld6e5eBArnoFIqzgNXM55Dl5i1SLs0FqkW53kNOoyVCp8MjvmZQ4uqOpl3EJ63G+CN9xU5LFa4bBhvyUfOpy13WeZ21IeUfLtsSimab1pTZap5cUd8i3U0bwQe6SxyfEY78jxLLC+rytei7AlaLe05pzhsQBuTJ8krNYCoLeuhFkpLpXSgskZHZ60j3eCCBrhdgT0lr+y6e3wfsgwpK7dTXtszLLFdqg9jilsyx0Gi5w1NmtSRCwlVaSSXQsrsk9E0NX5bwpgqbXUhZjOonq2bje5Ry4bd3npxvBQx6Jt+UCM9ITcFGbSAB03RcrVTjUAf2aBkhZdZeSlF2SAweXFZhPq1Vf+QZrFQsz/8tt+XVvacxQlCGh1B+5YBZlzqT/PFV3FOYs3qtJooUh8UMoZt4AH6xvKV30b2DtWh44X4omWHS34soM4YxDSgPkhdfSO+1YRWx5aPA3k0vvWjpPjO6wWXWqag1g37PkTBYNBBJXjKpoTCNmgciXOvNTOkAR7UKjQmGrpPEr/zBC6+YMKPuA0RXwuzo29yrg35l8//dnfI9Sf9Nc+cUXW4Bmul1iTUQ2DPq6vcB6MWbHNpHDvOxM6pRxx43tlGAAHncYXgoYaTNRQDVsSl6I2U4hS+WqBdZEMpWBhwTjmreJNgpTMX03rEBMFDLjUL2POLrZRn5nsMx5MQD0YcVHa1gK2y07QATvfh48e9bRDgkizdVkmaE7ijmsDmhbTeU48hQt7dtptCoGgEP4uZXV0azImPYkqOQzHIbd1A1qXiVLwR8jcmNkNn3c/R6IWWiOKx1+qyddsAqdE0SK1WU7uKsIMpJrIhsO3aWNyhM+/pcVTjvSL/CiplgjAMSNaT8r0dNEau3RqXAdQLe3YjXg8pU0mHeja6PQoLmI9cNuQVBUFB/sSxgj+TNrQzAvm7MgtKgrD85o1swwAWfWvBL/v9r/QNf4vRFiV9CuyO2EVt8otxi7odmiquIsIw4N5/Hv7DKq4SgmJ5bwjsPwKvNER9gidbjyb+joDbhnhMGaJ/hNS+2lS87/4H4KM8AA=='.decode('base64').decode('zip')

在线尝试!

实际代码:

from random import*
c=lambda*a:choice(a)
print'Did you know that '+c('the '+c('fall','spring')+' equinox','the '+c('winter','summer')+' '+c('solstice','olympics'),'the '+c('earliest','latest')+' '+c('sunrise','sunset'),'daylight saving'+c('','s')+' time','leap '+c('day','year'),'easter','the '+c('harvest','super','blood')+' moon','toyota truck month','shark week')+' '+c('happens '+c('earlier','later','at the wrong time')+' every year','drifts out of sync with the '+c('sun','moon','zodiac',c('gregorian','mayan','lunar','iPhone')+' calendar','atomic clock in colorado'),'might '+c('not happen','happen twice')+' this year')+' because of '+c('time zone legislation in '+c('indiana','arizona','russia'),'a decree by the Pope in the 1500s',c('precession','libation','nutation','libation','eccentricity','obliquity')+' of the '+c('moon','sun',"earth's axis",'equator','prime meridian',c('international date','mason-dixon')+' line'),'magnetic field reversal','an arbitrary decision by '+c('Benjamin Franklin','Isaac Newton','FDR'))+'? Apparently '+c('it causes a predictable increase in car accidents',"that's why we have leap seconds",'scientists are really worried','it was even more extreme during the '+c('bronze age','ice age','cretacious','1990s'),"there's a proposal to fix it, but it "+c('will never happen','actually make things worse','is stalled in Congress','might be unconstitutional'),"it's getting worse and no one knows why")+'. While it may seem like trivia, it '+c('causes huge headaches for software developers','is taken advantage of by high-speed traders','triggered the 2003 Northeast Blackout','has to be corrected for by GPS satellites','is now recognized as a major cause of World War I')+'.'

太累了。我什至没有做过基本的高尔夫运动。有人请写一个脚本来打高尔夫球。


我认为这没有达到在Gregorian / Mayan / Lunar / iPhone日历节点上每个决策节点具有相等伪随机机会的规范。对于嵌入在另一个选择中的这四种日历类型,您具有选择功能。这意味着“格里高利历”的可能性是“科罗拉多州的原子钟”的四分之一。
Sellyme '17

3
我认为这些是单独的决策节点。“不同步的漂移”连接到“太阳”,“月亮”,“十二生肖”,“ _日历”和“科罗拉多州的原子钟”,并且只能在“格里高利”,“玛雅”,“月球”和“ iPhone”之间进行选择如果选择了“日历”分支。编辑:此外,参考实现具有相同的行为。
17Me21年

是的,无论它有多少个子节点,每个节点均分。
亚当

看来您两次获得“解放”-其中之一应该是“解放”。至少在未压缩的代码中-不确定压缩版本是否相同。
James Holderness

3

木炭,806字节

≔”}‽÷⌊&β¶&⁰5EYB∕¤ⅉ‖≧I2[y·↔m⁷b∕¶⎆w‹ta≔Þ…¤eN⌕⟦1H}⁷φb$≧xζ→j5⮌↗2Σ↶C$JiψT↧⊘ν;{Fκⅉ⊘V⁵)}LZ)←‴F9cCIj+FJ➙N¶℅Pφ⦄≧πΦjt/;⊗…→⎇↓y⁻OD¤HRw2◧eE≦⊗▶⁴Uμ4⁶⊟P}⁼Ruf→u≧″℅9ξ→W⊗7≧↨↥ω⎚,_-,*U∕$⊖τJb4%L'⪪*⎇⊕>Þ↨IQ.&XVSv⧴×↑N:εγC~f≔hI¶⊖⎇N6ydy"⁸?⁷∕Oυ⁻~Þ⁶πv″ZOgΦ✂⊘qV↓Y5U,fν¶⁼⟲Y⁺⪪“↓‹5Hψ.>⊕LS⁸◨›±3¤�[<⊟D´YυΣOR↓↓g⟧⎈″:;9≧¿×➙ρlZσ31‴8↖HXυ3@⁺�@δIΣ≔⁺@ⅉCX⎇",H²⁻↥uνu⎚⌊ÀW⊘∕U ψu]q➙⟲BoF⧴Qψ8)Zk⌕⊗ü;≡N±$⊞QU≕⁹↘NYFY?⊗↖\≦∧₂!Fd⌈B"η№⁻⎈O2jηQμfÞωσdJ↧Àκ«ⅈ∕+¤êE�№F´⟲τ₂Gξr1⦃:>Oa²O[)¬X⎚∧V⊖«⪫J⁼0✂⦄Blν≦&C₂?⁹κIWÞ⁶≕>u/EKπd4ζ¤h]≕D@;VWR$▷ω≔BU″″◧⁸|%↔φ;Φ?@R:↙!,⧴¹3H%⁸⧴↨⁵&⁼E¶N V⬤⌊←}⁸⁺aw⌈Vς2A§A⟦W3«;{aZKl⊞Lξd⌊2≦2?⎈OM↔ü?⎚_Q▶δMp>{✂Mx§+↔⎆}Cκ·W∧Sd⎇⁹_ςCüI.G↓x≕χ«]n⦄&➙{‽ι⦃⁺^⦃Jk⎈O+oκs◧¿#W↙QR[Lα±´@⁰¶◧⊗βυ⊕⁴…«✳τi"TWι&=l¦⦄Þ⪪Þ▷‴υγ±A↥2⭆⁴≕↖≔…L¦ê⊘↥Bwψ¦⊘⊕*YkxAyg-'≦sΦd4◨υÀ?⁶[)…WS×∧ηt\e↗⊕Xκ≕№q₂‽Az←ERT◨⟦◨<1↧Φ…⊗E›c*«R↥M6-±⌀↑F⟲#π'F5/±κ;↗~&ζTUI⁺U⦃⸿?^↙i⧴t”θFβ≔⁺⁺§⪪θι⁰‽✂⪪θι¹±¹¦¹⊟⪪θιθθ

在线尝试!链接是详细版本的代码。说明:

 ”....”                             Compressed string
≔      θ                            Assign to `q`
         β                          Lowercase letters
        F                           Loop over each letter
              ⪪θι   ⪪θι      ⪪θι    Split `q` at that letter
             §   ⁰                  First string in split (i.e. prefix)
                   ✂   ¹±¹¦¹        Slice split excluding prefix and suffix
                  ‽                 Select random element
                            ⊟       Pop last string (i.e. suffix)
           ⁺⁺                       Concatenate
          ≔                     θ   Assign to `q`
                                 θ  Print `q`

3

R1903 1751 1743字节

一个简单的暴力解决方案。可能是将高尔夫球击倒的一种方法。

p=paste
P=paste0
s=function(...)sample(c(...),1)
C='calendar'
T='the'
P(p('Did you know that',s(p(T,s('Fall','Spring'),'Equinox'),p(T,s('Winter','Summer'),s('Solstice','Olympics')),p(T,s('Earliest','Latest'),s('Sunrise','Sunset')),P('Daylight Saving',s('s',''),' Time'),p('Leap',s('Day','Year')),'Easter',p(T,s('Harvest','Super','Blood'),'Moon'),'Toyota Truck Month','Shark Week'),s(p('happens',s('earlier','later','at the wrong time'),'every year'),p('drifts out of sync with the',s('Sun','Moon','Zodiac',p('Gregorian',C),p('Mayan',C),p('Lunar',C),p('iPhone'),'atomic clock in Colorado')),p('might',s('not happen','happen twice'),'this year')),'because of',s(p('time zone legislation in',s('Indiana','Arizona','Russia')),'a decree by the pope in the 1500s',p(s('precession','libration','nutation','libation','eccentricity','obliquity'),'of the',s('Moon','Sun',"Earth's axis",'equator','prime meridian','international date line','mason-dixon line')),'magnetic field reversal',p('an arbitrary decision by',s('Benjamin Franklin','Isaac Newton','FDR')))),'? Apparently ',s('it causes a predictable increase in car accidents',"that's why we have leap seconds",'scientists are really worried',p('it was even more extreme during the',s('Bronze Age','Ice Age','Cretaceous','1990s')),p("there's a proposal to fix it, but it",s('will never happen','actually makes things worse','is stalled in congress','might be unconstitutional')),"it's getting worse and no one knows why"),'. While it may seem like trivia, it ',s('causes huge headaches for software developers','is taken advantage of by high-speed traders','triggered the 2003 Northeast Blackout','has to be corrected for by GPS satellites','is now recognized as a major cause of World War I'),'.')

在线尝试!


2

JavaScript(ES6),1275字节

f=(s=btoa`...`)=>/h/.test(s)?f(s.replace(/g([^gi]+)i/,(_,x)=>` ${(x=x.split`h`)[Math.random()*x.length|0]} `)):s.replace(/[a-f]/g,x=>" '-?,."['0x'+x-10]).replace(/ +(\W)/g,'$1')

其中...表示atob()在此字符串上运行并用,替换为,0x00 替换\\\,0x0D替换为的结果:`\`\0\r

DIDaYOUaKNOWaTHATgTHEgFALLhSPRINGiEQUINOXhTHEgWINTERhSUMMERigSOLSTICEhOLYMPICSihTHEgEARLIESThLATESTigSUNRISEhSUNSETihTHEgHARVESThSUPERhBLOODiMOONhDAYLIGHTgSAVINGhSAVINGSiTIMEhLEAPgDAYhYEARihEASTERhTOYOTAaTRUCKaMONTHhSHARKaWEEKigHAPPENSgEARLIERhLATERhATaTHEaWRONGaTIMEiEVERYaYEARhDRIFTSaOUTaOFaSYNCaWITHaTHEgSUNhMOONhZODIAChgGREGORIANhMAYANhLUNARhIPHONEiCALENDARhATOMICaCLOCKaINaCOLORADOihMIGHTgNOTaHAPPENhHAPPENaTWICEiTHISaYEARiBECAUSEaOFgTIMEaZONEaLEGISLATIONaINgINDIANAhARIZONAhRUSSIAihAaDECREEaBYaTHEaPOPEaINaTHEa1500ShgPRECESSIONhLIBRATIONhNUTATIONhLIBRATIONhECCENTRICITYhOBLIQUITYiOFaTHEgSUNhMOONhEARTHbSaAXIShEQUATORhPRIMEaMERIDIANhINTERNATIONALaDATEaLINEhMASONcDIXONaLINEihMAGNETICaFIELDaREVERSALhANaARBITRARYaDECISIONaBYgBENJAMINaFRANKLINhISSACaNEWTONhFDRiidaAPPARENTLYgITaCAUSESaAaPREDICTABLEaINCREASEaINaCARaACCIDENTShTHATbSaWHYaWEaHAVEaLEAPaSECONDShSCIENTISTSaAREaREALLYaWORRIEDhITaWASaEVENaMOREaEXTREMEaDURINGaTHEgBRONZEaAGEhICEaAGEhCRETACEOUSh1990SihTHEREbSaAaPROPOSALaTOaFIXaITeaBUTaITgWILLaNEVERaHAPPENhACTUALLYaMAKESaTHINGSaWORSEhISaSTALLEDaINaCONGRESShMIGHTaBEaUNCONSTITUTIONALihITbSaGETTINGaWORSEaANDaNOaONEaKNOWSaWHYifaWHILEaITaMAYaSEEMaLIKEaTRIVIAeaITgCAUSESaHUGEaHEADACHESaFORaSOFTWAREaDEVELOPERShISaTAKENaADVANTAGEaOFaBYaHIGHcSPEEDaTRADERShTRIGGEREDaTHEa2003aNORTHEASTaBLACKOUThHASaTOaBEaCORRECTEDaFORaBYaGPSaSATELLITEShISaNOWaRECOGNIZEDaASaAaMAJORaCAUSEaOFaWORLDaWARaIif

在这里尝试,减去btoa

f=(s="DIDaYOUaKNOWaTHATgTHEgFALLhSPRINGiEQUINOXhTHEgWINTERhSUMMERigSOLSTICEhOLYMPICSihTHEgEARLIESThLATESTigSUNRISEhSUNSETihTHEgHARVESThSUPERhBLOODiMOONhDAYLIGHTgSAVINGhSAVINGSiTIMEhLEAPgDAYhYEARihEASTERhTOYOTAaTRUCKaMONTHhSHARKaWEEKigHAPPENSgEARLIERhLATERhATaTHEaWRONGaTIMEiEVERYaYEARhDRIFTSaOUTaOFaSYNCaWITHaTHEgSUNhMOONhZODIAChgGREGORIANhMAYANhLUNARhIPHONEiCALENDARhATOMICaCLOCKaINaCOLORADOihMIGHTgNOTaHAPPENhHAPPENaTWICEiTHISaYEARiBECAUSEaOFgTIMEaZONEaLEGISLATIONaINgINDIANAhARIZONAhRUSSIAihAaDECREEaBYaTHEaPOPEaINaTHEa1500ShgPRECESSIONhLIBRATIONhNUTATIONhLIBRATIONhECCENTRICITYhOBLIQUITYiOFaTHEgSUNhMOONhEARTHbSaAXIShEQUATORhPRIMEaMERIDIANhINTERNATIONALaDATEaLINEhMASONcDIXONaLINEihMAGNETICaFIELDaREVERSALhANaARBITRARYaDECISIONaBYgBENJAMINaFRANKLINhISSACaNEWTONhFDRiidaAPPARENTLYgITaCAUSESaAaPREDICTABLEaINCREASEaINaCARaACCIDENTShTHATbSaWHYaWEaHAVEaLEAPaSECONDShSCIENTISTSaAREaREALLYaWORRIEDhITaWASaEVENaMOREaEXTREMEaDURINGaTHEgBRONZEaAGEhICEaAGEhCRETACEOUSh1990SihTHEREbSaAaPROPOSALaTOaFIXaITeaBUTaITgWILLaNEVERaHAPPENhACTUALLYaMAKESaTHINGSaWORSEhISaSTALLEDaINaCONGRESShMIGHTaBEaUNCONSTITUTIONALihITbSaGETTINGaWORSEaANDaNOaONEaKNOWSaWHYifaWHILEaITaMAYaSEEMaLIKEaTRIVIAeaITgCAUSESaHUGEaHEADACHESaFORaSOFTWAREaDEVELOPERShISaTAKENaADVANTAGEaOFaBYaHIGHcSPEEDaTRADERShTRIGGEREDaTHEa2003aNORTHEASTaBLACKOUThHASaTOaBEaCORRECTEDaFORaBYaGPSaSATELLITEShISaNOWaRECOGNIZEDaASaAaMAJORaCAUSEaOFaWORLDaWARaIif")=>/h/.test(s)?f(s.replace(/g([^gi]+)i/,(_,x)=>` ${(x=x.split`h`)[Math.random()*x.length|0]} `)):s.replace(/[a-f]/g,x=>" '-?,."['0x'+x-10]).replace(/ +(\W)/g,'$1')
document.write(f())


2

APL(Dyalog),1302 字节

'[a-z]'R' \u&''⍠[^⍠⌸]*⌸'R{(?∘≢⊃⊢)⍵.Match(∊⊆⊣)⎕AV}⍣≡'DIDyOUkNOWtHAT⍠tHE⍠fALL⌺sPRING⌸eQUINOX⌺tHE⍠wINTE⌺sUMME⌸R⍠sOLSTICE⌺oLYMPICS⌸⌺tHE⍠eARLI⌺lAT⌸ESTsUN⍠RISE⌺SET⌸⌺dAYLIGHTsAVING⍠ ⌺S ⌸TIME⌺lEAP⍠dAY⌺yEAR⌸⌺eASTER⌺tHE⍠hARVEST⌺sUPER⌺bLOOD⌸mOON⌺tOYOTAtRUCKmONTH⌺sHARKwEEK⌸⍠hAPPENS⍠eARLIER⌺lATER⌺aTtHEwRONGtIME⌸eVERYyEAR⌺dRIFTSoUToFsYNCwITHtHE⍠sUN⌺mOON⌺zODIAC⌺⍠gREGORIAN⌺mAYAN⌺lUNAR⌺iPHONE⌸cALENDAR⌺aTOMICcLOCKiNcOLORADO⌸⌺mIGHT⍠nOThAPPEN⌺hAPPENtWICE⌸tHISyEAR⌸bECAUSEoF⍠tIMEzONElEGISLATIONiN⍠iNDIAN⌺aRIZON⌺rUSSI⌸A⌺adECREEbYtHEpOPEiNtHE 1500S⌺⍠pRECESSION⌺lIBRATION⌺nUTATION⌺lIBATION⌺eCCENTRICITY⌺oBLIQUITY⌸oFtHE⍠mOON⌺sUN⌺eARTH''SaXIS⌺eQUATOR⌺pRIMEmERIDIAN⌺⍠iNTERNATIONALdATE⌺mASON-DIXON⌸lINE⌸⌺mAGNETICfIELDrEVERSAL⌺aNaRBITRARYdECISIONbY⍠bENJAMINfRANKLIN⌺iSAACnEWTON⌺fDR⌸⌸?aPPARENTLY⍠iTcAUSESapREDICTABLEiNCREASEiNcARaCCIDENTS⌺tHAT''SwHYwEhAVElEAPsECONDS⌺sCIENTISTSaRErEALLYwORRIED⌺iTwASmOREeXTREMEdURINGtHE ⍠BRONZEaGE⌺ICEaGE⌺CRETACEOUS⌺1990S⌸⌺tHERE''SapROPOSALtOfIXiT,bUTiT⍠wILLnEVERhAPPEN⌺aCTUALLYmAKEStHINGSwORSE⌺iSsTALLEDiNcONGRESS⌺mIGHTbEuNCONSTITUTIONAL⌸⌺iT''SgETTINGwORSEaNDnOoNEkNOWSwHY⌸.wHILEiTmAYsEEMlIKEtRIVIA,iT⍠cAUSEShUGEhEADACHESfORsOFTWAREdEVELOPERS⌺iStAKENaDVANTAGEoFbYhIGH-SPEEDtRADERS⌺tRIGGEREDtHE 2003nORTHEASTbLACKOUT⌺hAStObEcORRECTEDfORbYgPSsATELLITES⌺iSnOWrECOGNIZEDaSamAJORcAUSEoFwORLDwARi⌸.'

在线尝试!

亚当帮助完成了这个任务……然后挑战我完成任务。:P

-11感谢Adám(使用他的新SBCS工具,我可以滥用编码而无需支付额外费用)。



@Adám是的,我记得...
暴民埃里克(Erik the Outgolfer)

2

Haskell1949 1938字节

import System.Random
data T a=N a[T a](T a)|P Char(T a)|E
l s=N s[]E
t=N"the"
w=map l.words
k=map l.lines
d=N""
g!a|(i,h)<-randomR(0,length a-1)g=(a!!i,h)
g#E=("",g)
g#(P c n)|(e,v)<-g#n=(c:e,v)
g#(N s[]n)|(e,v)<-g#n=([' '|s>""]++s++e,v)
g#(N s c n)|(p,q)<-g!c,(m,h)<-q#p,(e,v)<-h#n=([' '|s>""]++s++m++e,v)
tail.fst.(#N"Did you know that"[t(w"fall spring")$l"equinox",t(w"winter summer")$d(w"solstice olympics")E,t(w"earliest latest")$d(w"sunrise sunset")E,N"daylight"(w"saving savings")$l"time",N"leap"(w"day year")E,l"easter",t(w"harvest super blood")$l"moon",l"Toyota truck month",l"shark week"](d[N"happens"(k"earlier\nlater\nat the wrong time")$l"every year",N"drifts out of sync with the"[l"sun",l"moon",l"zodiac",d(w"gregorian mayan lunar iPhone")$l"calendar",l"atomic clock in Colorado"]E,N"might"(k"not happen\nhappen twice")$l"this year"]$N"because of"[N"time zone legislation in"(w"Indiana Arizona Russia")E,l"a decree by the Pope in the 1500s",d(w"precession libration nutation libation eccentricity obliquity")$N"of the"(k"moon\nsun\nEarth's axis\nequator\nprime meridian\ninternational date line\nMason-Dixon line")E,l"magnetic field reversal",N"an arbitrary decision by"(k"Benjamin Franklin\nIsaac Newton\nFDR")E]$P '?'$N"Apparently"[l"it causes a predictable increase in car accidents",l"that's why we have leap seconds",l"scientists are really worried",N"it was even more extreme during the"[l"bronze age",l"ice age",l"cretaceous",l"1990's"]E,N"there's a proposal to fix it, but it"(k"will never happen\nactually makes things worse\nis stalled in congress\nmight be unconstitutional")E,l"it's getting worse and no one knows why"]$P '.'$N"While it may seem like trivia, it"(k"causes huge headaches for software developers\nis taken advantage of by high-speed traders\ntriggered the 2003 Northeast Blackout\nhas to be corrected for by GPS satellites\nis now recognized as a major cause of World War I")$P '.'E))<$>newStdGen

在线尝试!(具有的额外2个字节f=

通常写这个只是为了创建数据结构。这肯定可以改善,但是我很累,无论如何我都必须离开。我认为大写基本上是正确的,但是如果不正确,我会将其全部转换为大写。因为我没有对字符串数据做任何奇怪的事情,所以不会改变字节数或其他任何东西。

基本思想是树的链接列表,其中每个节点为空(E),标点符号(P)或带有子项的字符串标签。除节点外,所有其他E节点都有一个跟随其后的“跟随者”节点。

编辑:刚注意到一个拼写错误(我写了“没人知道为什么”而不是“没人知道为什么”),所以我不得不添加一个字节来修复它,但是我还发现了一些可以删除的代码


0

APL(Dyalog Unicode),1593字节

C←?∘≢⊃⊢
S←C'|'∘≠⊆⊢
∊'Did you know that '(C('the '(S'Fall|Spring')' Equinox ')('the '(S'Winter |Summer ')(S'Solstice |Olympics '))('the '(S'Earliest |Latest ')(S'Sunrise |Sunset '))('Leap ',S'Day |Year ')'Easter '('the '(S'Harvest|Super|Blood')' Moon ')'Toyota Truck Month '('Daylight Savings Time '~C's∘')'Shark Week ')(C('happens '(S'earlier|later|at the wrong time')' every year ')('drifts out of sync with the '(S'Sun |Moon |Zodiac |atomic clock in Colorado|',' Calendar ',⍨S'Gregorian|Mayan|Lunar|iPhone'))('might '(S'not happen|happen twice')' this year '))'because of '(C('time zone legislation in ',S'Indiana|Arizona|Russia')'a decree by the pope in the 1500s'((S'precession|libration|nutation|libation|eccentricity|obliquity')' of the '(S'Moon|Sun|Earth''s axis|equator|prime meridian|',' line',⍨S'international date|mason-dixon'))'magnetic field reversal'('an arbitrary decision by ',S'Benjamin Franklin|Isaac Newton|FDR'))'? Apparently '(C'it causes a predictable increase in car accidents'('it was even more extreme during the ',S'Bronze Age|Ice Age|Cretaceous|1990s')'that''s why we have leap seconds'('there''s a proposal to fix it, but it ',S'will never happen|actually makes things worse|is stalled in congress|might be unconstitutional')'scientists are really worried' 'it''s getting worse and no one knows why')'. While it may seem like trivia, it '(S'causes huge headaches for software developers|is taken advantage of by high-speed traders|triggered the 2003 Northeast Blackout|has to be corrected for by GPS satellites|is now recognized as a major cause of World War I')'.'

在线尝试!

定义两个辅助函数,然后在一个巨型表达式中使用它们:

C← C(用于 C hoose)是
?∘≢ 一个随机数,最大为 从参数中
 选取
的参数中的元素数

S← S(用于S分割和S选择)是
C  中选择
'|'∘≠ 了哪里,没有管道
分割
 参数

ε NLIST(扁平化)
C从字符串列表中S选择,并从|定界字符串的子字符串中选择,这些仅组合使用即可构成“事实”。

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.