1930: "Calendar Facts"

This forum is for the individual discussion thread that goes with each new comic.

Moderators: Moderators General, Prelates, Magistrates

User avatar
squall_line
Posts: 163
Joined: Fri Mar 20, 2009 2:36 am UTC

1930: "Calendar Facts"

Postby squall_line » Mon Dec 18, 2017 4:47 pm UTC

Image

Alt-text: "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)."

Those damn high-speed trading algorithms... I KNEW it!

cct
Posts: 27
Joined: Wed Mar 14, 2012 1:55 pm UTC

Re: 1930: "Calendar Facts"

Postby cct » Mon Dec 18, 2017 4:52 pm UTC

I am disappointed that there is no path allowing "...because of the eccentricity of Isaac Newton..."

User avatar
pkcommando
Posts: 525
Joined: Fri Feb 10, 2012 3:22 pm UTC
Location: Allston, MA

Re: 1930: "Calendar Facts"

Postby pkcommando » Mon Dec 18, 2017 5:38 pm UTC

Did you know Comic #1930 will only happen one time ever? And come Friday it will never be the newest comic again?

What a time to be alive!
"The Universe is for raptors now!" say Raptors, as they take over all of Universe.

DavidSh
Posts: 112
Joined: Thu Feb 25, 2016 6:09 pm UTC

Re: 1930: "Calendar Facts"

Postby DavidSh » Mon Dec 18, 2017 5:47 pm UTC

Treating this as "Did you know <fact 1>? Apparently, <fact 2>.", I wonder how many of the branches can be traversed with paths where both facts are true. I'm having difficulty working the Mason Dixon Line into anything meaningful. It isn't part of any time zone boundaries.

User avatar
Flumble
Yes Man
Posts: 1991
Joined: Sun Aug 05, 2012 9:35 pm UTC

Re: 1930: "Calendar Facts"

Postby Flumble » Mon Dec 18, 2017 6:13 pm UTC

pkcommando wrote:Did you know Comic #1930 will only happen one time ever? And come Friday it will never be the newest comic again?

I hope to see a Wednesday comic –one that will be the newest from Wednesday until Friday– too.

Also, Randall accidentally left the pair of lines merging the international date and Mason-Dixon line black.

User avatar
orthogon
Posts: 2871
Joined: Thu May 17, 2012 7:52 am UTC
Location: The Airy 1830 ellipsoid

Re: 1930: "Calendar Facts"

Postby orthogon » Mon Dec 18, 2017 6:41 pm UTC

DavidSh wrote: I'm having difficulty working the Mason Dixon Line into anything meaningful. It isn't part of any time zone boundaries.

It's traditional in such cases to joke that there's a time difference of, say, fifty years between the two sides of the line. I won't dare to suggest which way round. Y'all are still a bit sore about the whole Civil War business from what I've gathered...
xtifr wrote:... and orthogon merely sounds undecided.

adw
Posts: 2
Joined: Mon Dec 18, 2017 6:43 pm UTC

Re: 1930: "Calendar Facts"

Postby adw » Mon Dec 18, 2017 6:46 pm UTC

163,800 facts in one comic! (ignoring title text)

User avatar
jc
Posts: 342
Joined: Fri May 04, 2007 5:48 pm UTC
Location: Waltham, Massachusetts, USA, Earth, Solar System, Milky Way Galaxy
Contact:

Re: 1930: "Calendar Facts"

Postby jc » Mon Dec 18, 2017 6:50 pm UTC

... because of ... libation? Lessee; is there anything in the next set of choices that's also (part of) the name of something drinkable, or at least liquid?

DavidSh
Posts: 112
Joined: Thu Feb 25, 2016 6:09 pm UTC

Re: 1930: "Calendar Facts"

Postby DavidSh » Mon Dec 18, 2017 7:20 pm UTC

I'd think the Libation of the Mason-Dixon Line (the Pennsylvania-Maryland border, in part), would be Rye Whiskey.
Of the Prime Meridian, Gin.

dtilque
Posts: 130
Joined: Sat Oct 11, 2008 5:53 am UTC
Location: Nogero

Re: 1930: "Calendar Facts"

Postby dtilque » Mon Dec 18, 2017 9:01 pm UTC

He missed "Blue" in the type of moons.


DavidSh wrote:I'd think the Libation of the Mason-Dixon Line (the Pennsylvania-Maryland border, in part), would be Rye Whiskey.
Of the Prime Meridian, Gin.


I think there's something about people on one side of the Mason-Dixon going just across the border to buy booze/fireworks/lottery/marijuana because taxes/illegal/irrational/complex/illegible.
Whenever visually representing the universe, it's important to include a picture of Saturn!
-- Tom the Dancing Bug

TimSheahan
Posts: 1
Joined: Mon Dec 18, 2017 8:09 pm UTC

Re: 1930: "Calendar Facts"

Postby TimSheahan » Mon Dec 18, 2017 9:04 pm UTC

Obligatory coded version -

Code: Select all

#!/usr/bin/perl

package All;
use warnings;
use Carp 'croak';
sub Of {
  my ($class, @fields) = @_;
  @fields or croak 'missing fields';
  return bless \@fields, $class;
}
sub Fields {
  my $self = shift;
  my @ret;
  foreach my $field (@$self){
    push @ret, ref($field) ? $field->Fields() : $field;
  }
  return @ret;
}

package One;

use warnings;
use Carp 'croak';
sub Of {
  my ($class, @fields) = @_;
  @fields or croak 'missing fields';
  return bless \@fields, $class;
}
sub Fields {
  my $self = shift;
  my $idx = int(rand(@$self));
  my $field = $self->[$idx];
  return ref($field) ? $field->Fields() : $field;
}

package main;

use strict;
use warnings;

my $facts = All->Of(
  'Did you know that',
  One->Of(
    All->Of(
      'the',
      One->Of(qw(Fall Spring)),
      'Equinox',
    ),
    All->Of(
      'the',
      One->Of(qw(winter summer)),
      One->Of(qw(solstice olympics)),
    ),
    All->Of(
      'the',
      One->Of(qw(earliest latest)),
      One->Of(qw(sunrise sunset)),
    ),
    All->Of(
      'daylight',
      One->Of(qw(saving savings)),
      'time',
    ),
    All->Of(
      'leap',
      One->Of(qw(day year)),
    ),
    'Easter',
    All->Of(
      'the',
      One->Of(qw(harvest super blood)),
      'moon',
    ),
    'toyota truck month',
    'shark week',
  ),
  One->Of(
    All->Of(
      'happens',
      One->Of(qw(earlier later at the wrong time)),
      'every year',
    ),
    All->Of(
      'drifts out of sync with the',
      One->Of(
        'sun',
        'moon',
        'zodiac',
        All->Of(
          One->Of(qw(gragorian mayan lunar iPhone)),
          'calendar',
        ),
        'atomic clock in colorado',
      ),
    ),
    All->Of(
      'might',
      One->Of('not happen', 'happen twice'),
      'this year',
    ),
  ),
  'because of',
  One->Of(
    All->Of(
      'time zone legislation in',
      One->Of(qw(Indiana Arizona Russia)),
    ),
    'a decree by the Pope in the 1500s',
    All->Of(
      One->Of(qw(precession libration nutation libation eccentricity obliquity)),
      'of the',
      One->Of(
        'Moon','Sun','Earth\'s axis','Equator','Prime Meridian',
        All->Of(
          One->Of('international date','Mason-Dixon'),
          'line',
        ),
      ),
    ),
    'magnetic field reversal',
    All->Of(
      'an arbitrary decision by',
      One->Of('Benjamin Franklin','Isaac Newton','FDR'),
    ),
  ),
  '?',
  'Apparently',
  One->Of(
    'it causes a predictable increase in car accidents',
    'that\'s why we have leap seconds',
    'scientists are really worried',
    All->Of(
      'it was even worse during the',
      One->Of('bronze age','ice age','cretaceous','1990s'),
    ),
    All->Of(
      'there\'s a proposal to fix it, but it',
      One->Of('will never happen','actually makes things worse','is stalled in congress','might be unconstitutional'),
    ),
    'it\'s getting worse and on one knows why',
  ),
  '.',
);

my @out;
foreach my $field ($facts->Fields) {
  if (length($field) > 1) {
    push @out, (' ',$field);
  } else {
    $out[-1] .= $field;
  }
}
shift @out;
print @out, "\n";


I had to... so then, why not share?

rlr
Posts: 1
Joined: Mon Dec 18, 2017 9:30 pm UTC

Re: 1930: "Calendar Facts"

Postby rlr » Mon Dec 18, 2017 9:35 pm UTC

I made a simple JS randomizer in Node for this comic. Have a look:

https://github.com/RickyRomero/xkcd-193 ... r-facts.js

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3182
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1930: "Calendar Facts"

Postby Soupspoon » Mon Dec 18, 2017 11:21 pm UTC

Flumble wrote:Also, Randall accidentally left the pair of lines merging the international date and Mason-Dixon line black.
Hactually, I thought so too, for a moment, but then realised that this particular track-to-follow was, in both of the merging cases, also being a hyphen. "International Date-Line" and "Mason-Dixon-Line".

Never mind that it is more properly "International Date Line"1 and "Mason-Dixon Line", I still think that it is clever!


1 Not to be confused with a Dateline, which may key in the relevant spacio-temporal focus of a news story for the benefit of a reader (trying to read a set of spinning newspapers rapidly forming a montage for the the 1930s filmgoer), or would you like to see the new film?

rowanmikaio
Posts: 8
Joined: Mon Dec 31, 2007 7:08 am UTC

Re: 1930: "Calendar Facts"

Postby rowanmikaio » Tue Dec 19, 2017 12:01 am UTC

adw wrote:163,800 facts in one comic! (ignoring title text)


I keep getting 156,000. Where am I going wrong? 20 in node 1, 13 in node 2, 50 in node 3 and 12 in node 4. I can't figure out where we differ.

User avatar
timrem
Posts: 25
Joined: Fri Mar 23, 2012 7:02 am UTC

Re: 1930: "Calendar Facts"

Postby timrem » Tue Dec 19, 2017 12:18 am UTC

rowanmikaio wrote:
adw wrote:163,800 facts in one comic! (ignoring title text)


I keep getting 156,000. Where am I going wrong? 20 in node 1, 13 in node 2, 50 in node 3 and 12 in node 4. I can't figure out where we differ.


163,800 = 21*13*50*12, so I'm guessing they miscounted the first node.

ruurdjan
Posts: 23
Joined: Mon Feb 06, 2012 8:33 am UTC

Re: 1930: "Calendar Facts"

Postby ruurdjan » Tue Dec 19, 2017 12:23 am UTC

TimSheahan wrote:Obligatory coded version -

I had to... so then, why not share?


I get:
"Did you know that leap day happens time every year because of an arbitrary decision by Benjamin Franklin? Apparently it's getting worse and on one knows why."

'time every year' ?

User avatar
whybird
Posts: 1
Joined: Thu Nov 16, 2017 1:05 am UTC

Re: 1930: "Calendar Facts"

Postby whybird » Tue Dec 19, 2017 4:33 am UTC

My friend also put a web version up.

I'm too new here to post with a link, but its at www [dot] pibweb [dot] com/xkcd_calendar.php

User avatar
Wee Red Bird
Posts: 177
Joined: Wed Apr 24, 2013 11:50 am UTC
Location: In a tree

Re: 1930: "Calendar Facts"

Postby Wee Red Bird » Tue Dec 19, 2017 7:52 am UTC

timrem wrote:
rowanmikaio wrote:
adw wrote:163,800 facts in one comic! (ignoring title text)


I keep getting 156,000. Where am I going wrong? 20 in node 1, 13 in node 2, 50 in node 3 and 12 in node 4. I can't figure out where we differ.


163,800 = 21*13*50*12, so I'm guessing they miscounted the first node.

I make it 20 in node 1 too. Could you have miscounted it?

User avatar
da Doctah
Posts: 864
Joined: Fri Feb 03, 2012 6:27 am UTC

Re: 1930: "Calendar Facts"

Postby da Doctah » Tue Dec 19, 2017 8:34 am UTC

Under the Gregorian calendar, no century can start on Sunday, Wednesday or Friday.

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3182
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1930: "Calendar Facts"

Postby Soupspoon » Tue Dec 19, 2017 10:24 am UTC

ruurdjan wrote:
TimSheahan wrote:Obligatory coded version -

I had to... so then, why not share?


I get:
"Did you know that leap day happens time every year because of an arbitrary decision by Benjamin Franklin? Apparently it's getting worse and on one knows why."

'time every year' ?


I think mine works Ok. It's certainly simpler than the whole class-based approach. Ignoring the comments that I felt compelled to add, and obviously the data-tree, it just gets it done.

Code: Select all

#!/bin/perl
use strict;
use warnings;

sub Branch { my ($method,$sofar,@opt) = @_;
  die "Not yet implemented!" if $method ne "?";
  ## For $method eq "*" (see EOF!), I was just gonna take $sofar, prepend it to
  ## each $item and Expand()ed $item (each of which come back themselves as a
  ## cummulative array(ref), so another ref check needed!) and return the array
  ## of all these, for the calling Expand to similarly ref-check each time it
  ## wanders into another sequence item.

  ## But I realised I could Iterator it, instead, and save on stuffing up
  ## memory, unnecessarily. Call next, call next, call next, etc, letting the
  ## Iterator keep track of the perumtation level. (The alternative call, to
  ## follow the current practice, being "call random". Or deliberately
  ## pseudorandom/repeatable, should one wish!)
 
  ## Not yet in this version, though.

  my $item = $opt[rand(@opt)];
  ($sofar.=$item)                         && return $sofar unless ref $item;
  ($sofar =Expand($method,$sofar,@$item)) && return $sofar unless ref $item ne "ARRAY";
  die "Item $item is ref ".ref($item)." when it shouldn't be!\n";
} # /sub Branch

sub Expand { my ($method,$sofar,@seq) = @_;
  foreach my $item (@seq) {
    ($sofar.=$item)                         && next unless ref $item;
    ($sofar =Branch($method,$sofar,@$item)) && next unless ref $item ne "ARRAY";
    die "Item $item is ref ".ref($item)." when it shouldn't be!\n";
  } # /foreach my $item

  $sofar;
} # /sub Expand


## Data structure: @facts is a bare array of sequential elements.
## Elements can be literal text (ref SCALAR) or a subarray (ref ARRAY).

## Arrayrefs in a sequential array (like the root one) to treat as subchoice.
## arrayrefs in a choice array treated as a subsequence. It strictly alternates.
## To dive straight into a choice that starts off (at the start of a sequence
## in) a choice, just double the array-ref. To dive straight into a sequence
## that is (first choice in) a sequence, just double the array-ref.

## (The alternate method I considered was to have each array of 'whateverness'
##  being forcibly prepended by $[0] being "Opt" or "Seq" (or, in the future,
##  anything else one might want, like "choose any three of five, any order" or
##  "two items, both must either rhyme or be alliterative, and they must be
##  returned in order of the emotion one feels upon hearing them shouted from a
##  sinking ship", if you so care to. But, right now, this is a one-trick
##  monkey of a script, so why are worrying? I've already overcomplicated
##  things with the $method. And, I suppose, the $sofar is unnecessary, as I
##  could have just printed every literal straight to screen as it becomes
##  discovered. But I may later on need it, as you can see. And I was even
##  going to put a nice word-wrapper on this, but then I'd have had to make
##  sure I wasn't assuming your terminal character width...  It works well
##  enough.)

## Anyway, if you don't like proofreading that (see the following), you can
## just create something like "sub Sequence(@_)" and sub Choice(@_)" to
## (identically!) nest your options but so that you can visually/otherwise
## make sure you haven't accidentally gone Choice(..,Choice(..),..) or
## Sequence(..,Sequence(..),..), and then you'd be fine enough!

## Indent/newline/whitespace style of the data layout is up to you, lso, and
## another one of the choices I made is to prefix continuation literals with
## the whitespace I could have instead have added onto the end of the thing
## they were continuing. (I could also have handled it automagically, by
## inserting space between abutting \w or \S matches, but with things like
## that 'hyphen merge' and all kinds of future fiddling, that would have
## needed coding around that I did not care to do, so I chose this way.)

## Another contentious issue is my (de)capitalisation from xkcd's style.

## Anyway, I happen to like this particular method of nesting (more compact
## than forcing parens to indent/outdent on their own lines, bare of
## everything but whitespace, comma/semi-colon punctuation and commentary) I
## just realise that it won't suit everyone. And it's for that reason that I
## resisted the urge to bring some of the shorter sequence options (and
## optional sequences!) onto a single line that had multi-open *and* multi-
## closing parens.

## But, for your benefit, I did also come back during tiding and added a
## commentary of layering (each [ inward and each ] outward) off to one side,
## behind the handy comment-vertical. It might help in case you fancy editing
## it around a bit and are wondering where it is safe to modify things. Don't
## say I don't try to help you!

## So, anyway, here's that data. Enjoy. Or skip to the bottom, but there's
## not much there to need understanding, same as there's not much above...

my @facts=("Do you know that",                                     # (Sequence
           [[" the",                                               #           Choice Sequence
             [" Fall",                                             #                           Choice
              " Spring"],                                          #                           EndChoice
             " equinox"],                                          #                  EndSequence
            [" the",                                               #                  Sequence
             [" Winter",                                           #                           Choice
              " Summer"],                                          #                           EndChoice
             [" Solstice",                                         #                           Choice
              " Olympics"]],                                       #                           EndChoice+Sequence
            [" the",                                               #                  Sequence
             [" earliest",                                         #                           Choice
              " latest"],                                          #                           EndChoice
             [" sunrise",                                          #                           Choice
              " sunset"]],                                         #                           EndChoice+Sequence
            [" Daylight",                                          #                  Sequence
             [" Savings",                                          #                           Choice
              " Saving"],                                          #                           EndChoice
             " Time"],                                             #                  EndSequence
            [" leap",                                              #                  Sequence
             [" day",                                              #                           Choice
              " year"]],                                           #                           EndChoice+Sequence
            " easter",                                             #
            [" the",                                               #                  Sequence
             [" Harvest",                                          #                           Choice
              " Super",                                            #
              " Blood"],                                           #                           EndChoice
             " Moon"],                                             #                  EndSequence
            " Toyota Truck Month",                                 #
            " Shark Week"],                                        #           EndChoice
           [[" happens",                                           #           Choice Sequence
             [" earlier",                                          #                           Choice
              " later",                                            #
              " at the wrong time"],                               #                           EndChoice
             " every year"],                                       #                  EndSequence
            [" drifts out of sync with the",                       #                  Sequence
             [" Sun",                                              #                           Choice
              " Moon",                                             #
              " Zodiac",                                           #
              [[" Gregorian",                                      #                                  Sequence Choice
                " Mayan",                                          #
                " Lunar",                                          #
                " iPhone"],                                        #                                           EndChoice
               " calendar"],                                       #                                  EndSequence
              " atomic clock in Colorado"]],                       #                           EndChoice+Sequence
            [" might",                                             #                  Sequence
             [" not happen",                                       #                           Choice
              " happen twice"],                                    #                           EndChoice
             " this year"]],                                       #                  EndSequence+Choice
           " because of",                                          #
           [[" time zone legislalation in",                        #           Choice Sequence
             [" Indiana",                                          #                           Choice
              " Arizona",                                          #
              " Russia"]],                                         #                           EndChoice+Sequence
            " a decree by the Pope in the 1500s",                  #
            [[" precession",                                       #                  Sequence Choice
              " libration",                                        #
              " nutation",                                         #
              " libation",                                         #
              " eccentricity",                                     #
              " obliquity"],                                       #                           EndChoice
             " of the",                                            #
             [" Moon",                                             #                           Choice
              " Sun",                                              #
              " Earth's axis",                                     #
              " equator",                                          #
              " Prime Meridian",                                   #
              [[" International Date",                             #                                  Sequence Choice
                " Mason-Dixon"],                                   #                                           EndChoice
               "-Line"]]],                                         #                                  EndSequence+Choice+Sequence
            " magnetic field reversal",                            #
            [" an arbitrary decision by",                          #                  Sequence         
             [" Benjamin Franklin",                                #                           Choice
              " Isaac Newton",                                     #
              " FDR"]]],                                           #                           EndChoice+Sequence+Choice
           "?\nApparently",                                        #
           [" it causes a predictable increase in car accidents.", #           Choice
            " that's why we have leap seconds.",                   #
            " scientists are really worried.",                     #
            [" it was even more extreme during the",               #                  Sequence
             [" bronze age.",                                      #                           Choice
              " ice age.",                                         #
              " cretaceous.",                                      #
              " 1990s."]],                                         #                           EndChoice+Sequence
            [" theres a proposal to fix it, but it",               #                  Sequence
             [" will never happen.",                               #                           Choice
              " actually makes things worse.",                     #
              " is stalled in congress.",                          #
              " might be unconstitutional."]],                     #                           EndChoice+Sequence
            " its getting worse and no one knows why."]);          #           EndChoice+Sequence)
     
## I was thinking I'd give you two choices of calls:
## 1) Call random possibility.
print Expand("?","",@facts);

## 2) Call *every* possibility. (Not yet implemented, though I've put the basic store/transfer machinary in place.)
#print Expand("*","",@facts);


(I stuck with die, rather than fancy carping and croaking, because it's firmly old-school, like me.)

((Ouch. My nest commenting wraps. What's the default columns for a code-tag? 100? It's narrower than my screen, so I'll bear that in mind in future, even if I can't plan for what it might squeeze to on smalled portrait-moded displays. And all that's after that's after trying to keep the rest of my comments (and most of the code) to within 80char, by eye.))

alfeberlin
Posts: 2
Joined: Sat Jan 09, 2010 3:00 am UTC

Re: 1930: "Calendar Facts"

Postby alfeberlin » Tue Dec 19, 2017 11:15 am UTC

Here's the Python version. As usual, way more readable than the Perl version >;-)

Code: Select all

#!/usr/bin/python3

import random

def choice(*options):
    return random.choice(options)

def join(*words):
    return " ".join(words)

def trivia():
    return join(intro(), subject(), proposition(), reason(), collateral(),
                afterthought())

def intro():
    return "Did you know that"

def subject():
    def equinox():
        return join("the", choice("fall", "spring"), "equinox")
    def solstice_olympics():
        return join("the", choice("winter", "summer"),
                    choice("solstice", "olympics"))
    def sun_event():
        return join("the", choice("earliest", "latest"),
                    choice("sunrise", "sunset"))
    def dst():
        return join("daylight", choice("saving", "savings"), "time")
    def leap():
        return join("leap", choice("day", "year"))
    def easter():
        return "easter"
    def moon():
        return join("the", choice("harvest", "super", "blood"), "moon")
    def toyota_truck_month():
        return "Toyota truck month"
    def shark_week():
        return "shark week"
    return choice(equinox, solstice_olympics, sun_event, dst, leap, easter,
                  moon, toyota_truck_month, shark_week)()

def proposition():
    def happens():
        return join("happens", choice("earlier", "later", "at the wrong time"),
                    "every year")
    def drifts():
        def sun():
            return "sun"
        def moon():
            return "moon"
        def zodiac():
            return "zodiac"
        def calendar():
            return join(choice("Gregorian", "Mayan", "lunar", "iPhone"),
                        "calendar")
        def atomic_clock():
            return "atomic clock in Colorado"
        return join("drifts out of sync with the",
                    choice(sun, moon, zodiac, calendar, atomic_clock)())
    def might():
        return join("might", choice("not happen", "happen twice"), "this year")
    return choice(happens, drifts, might)()

def reason():
    def time_zone():
        return join("time zone legislation in",
                    choice("Indiana", "Arizona", "Russia"))
    def decree():
        return "a decree by the pope in the 1500s"
    def variants():
        def moon():
            return "moon"
        def sun():
            return "sun"
        def earth_axis():
            return "Earth's axis"
        def equator():
            return "equator"
        def prime_meridian():
            return "prime meridian"
        def line():
            return join(choice("international date", "Mason-Dixon"), "line")
        return join(
            choice("precession", "libration", "nutation", "libation",
                   "eccentricity", "obliquity"), "of the",
            choice(moon, sun, earth_axis, equator, prime_meridian, line)())
    def magnetic_field_reversal():
        return "magnetic field reversal"
    def decision():
        return join("an arbitrary decision by",
                    choice("Benjamin Franklin", "Isaac Newton", "FDR"))
    return join("because of",
                choice(time_zone, decree, variants, magnetic_field_reversal,
                       decision)()) + "? "

def collateral():
    def increase():
        return "it causes a predictable increase in car accidents"
    def leap_seconds():
        return "that's why we have leap seconds"
    def worried():
        return "scientists are really worried"
    def extreme():
        return join("it was even more extreme during the",
                    choice("bronze age", "ice age", "cretaceous", "1990s"))
    def fix():
        return join("there's a proposal to fix it, but it",
                    choice("will never happen", "actually makes things worse",
                           "is stalled in congress",
                           "might be unconstitutional"))
    def getting_worse():
        return "it's getting worse and no one knows why"
    return join("Apparently",
                choice(increase, leap_seconds, worried, extreme, fix,
                       getting_worse)()) + ". "

def afterthought():
    return (join("While it may seem like trivia, it",
                 choice("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")) +
            ".")

def main(argv):
    print(trivia())

if __name__ == '__main__':
    import sys
    sys.exit(main(sys.argv))

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3182
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1930: "Calendar Facts"

Postby Soupspoon » Tue Dec 19, 2017 12:22 pm UTC

Maybe more readable. My @facts are unsullied by any keywords/function names, and readability is reduced only by choice of layout. :P

I could also have done a version with hash of hashesn that would have looked similar to that Python (less wordy) but then I might as well roll it up into something like a http://playfic.com generator script. ;)

Code: Select all

The conversation is "Did you know that [something] [happens] [because]?[line break][Apparently]."

To say something: say "[one of][equinox][or][solstice][or][suntime][or][DST][or][leap][or]easter[or][moontime][or]Toyota Truck Month[or]Shark Week[at random]".

To say equinox: say "the [one of]Fall[or]Spring[or] Solstice"


To say happens: say "happens [one of][wrongly][or][drifty][or][misnumbered][at random]"


To say because: say "because of [one of][timezones][or]a decree by the Pope in the 1500s[or]…


To say Apparently: say "Apparently [one of]…


I'll let you fill in the rest. ;)

User avatar
timrem
Posts: 25
Joined: Fri Mar 23, 2012 7:02 am UTC

Re: 1930: "Calendar Facts"

Postby timrem » Tue Dec 19, 2017 1:29 pm UTC

Wee Red Bird wrote:
timrem wrote:
rowanmikaio wrote:
adw wrote:163,800 facts in one comic! (ignoring title text)


I keep getting 156,000. Where am I going wrong? 20 in node 1, 13 in node 2, 50 in node 3 and 12 in node 4. I can't figure out where we differ.


163,800 = 21*13*50*12, so I'm guessing they miscounted the first node.

I make it 20 in node 1 too. Could you have miscounted it?

You may have misinterpreted my statement: I was supporting rowanmikaio's calculation by pointing out adw's mistake.

User avatar
Sonic#
Posts: 35
Joined: Tue Oct 24, 2006 12:44 am UTC
Location: Tennessee
Contact:

Re: 1930: "Calendar Facts"

Postby Sonic# » Tue Dec 19, 2017 9:15 pm UTC

Did you know that time moves four times faster for people born on leap days? Four years pass for every year they could be born, so in compensation their bodies age four times faster to cycle back to normal time. If you slow down your pace of speech by four times, they will understand you but think you're a dummy because they've intuitively learned to deal with the double temporal parallax.
"Stars, I have seen them fall,
But when they drop and die
No star is lost at all
From all the star-sown sky.
The toil of all that be
Helps not the primal fault;
It rains into the sea
And still the sea is salt."
~A.E. Housman

adw
Posts: 2
Joined: Mon Dec 18, 2017 6:43 pm UTC

Re: 1930: "Calendar Facts"

Postby adw » Tue Dec 19, 2017 10:29 pm UTC

timrem wrote:
Wee Red Bird wrote:
timrem wrote:
rowanmikaio wrote:
adw wrote:163,800 facts in one comic! (ignoring title text)


I keep getting 156,000. Where am I going wrong? 20 in node 1, 13 in node 2, 50 in node 3 and 12 in node 4. I can't figure out where we differ.


163,800 = 21*13*50*12, so I'm guessing they miscounted the first node.

I make it 20 in node 1 too. Could you have miscounted it?

You may have misinterpreted my statement: I was supporting rowanmikaio's calculation by pointing out adw's mistake.


Yep. miscounted node 1. not sure where the extra one came from...

gd1
Posts: 115
Joined: Wed Nov 14, 2012 5:42 am UTC

Re: 1930: "Calendar Facts"

Postby gd1 » Tue Dec 19, 2017 11:38 pm UTC

Did you know that Toyota Truck month drifts out of sync with the Mayan calendar because of nutation of the Mason-Dixon Line? Apparently scientists are really worried.

rmsgrey
Posts: 3340
Joined: Wed Nov 16, 2011 6:35 pm UTC

Re: 1930: "Calendar Facts"

Postby rmsgrey » Wed Dec 20, 2017 3:30 am UTC

gd1 wrote:Did you know that Toyota Truck month drifts out of sync with the Mayan calendar because of nutation of the Mason-Dixon Line? Apparently scientists are really worried.

Are they worried because people are saying things like that as though they make sense? Because that would make sense.

lucasbatt
Posts: 1
Joined: Tue Dec 19, 2017 4:04 pm UTC

Re: 1930: "Calendar Facts"

Postby lucasbatt » Wed Dec 20, 2017 8:41 am UTC

rlr wrote:I made a simple JS randomizer in Node for this comic. Have a look:

https://github.com/RickyRomero/xkcd-193 ... r-facts.js


Nice! Looks great. I had the same idea! I made a js implementation, based on the famous Dada Engine but a super simplifier version. No need for Node. just call the function fact() and get a fact!

I'm too new to post a link, but a live version is a lucasbattich [dot] com / calendar

Here's the code:

Code: Select all

function fact() {

  var what = choice(
    seq("the ", choice("fall", "spring"), " equinox"),
    seq("the ", choice("winter", "summer"), " ", choice("solstice", "olympics")),
    seq("the ", choice("earliest", "latest"), " ", choice("sunrise", "sunset")),
    seq("daylight ", choice("saving", "savings"), " time"),
    seq("leap ", choice("day", "year")),
    "Easter",
    seq("the ", choice("harvest", "super", "blood"), " moon"),
    "Toyota Truck Month",
    "Shark Week");

  var willDo = choice(
    seq("happens ", choice("earlier", "later", "at the wrong time"), " every year"),
    seq("drifts out of sync with the ", choice(
      choice("sun", "moon", "zodiac"),
      seq(choice("Gregorian", "Mayan", "lunar", "iPhone"), " calendar"),
      "atomic clock in Colorado")),
    seq("might ", choice("not happen", "happen twice"), " this year") );

  var geoReason = seq(
    choice("precession", "libration", "nutation", "libation", "eccentricity", "obliquity"),
    " of the ",
    choice("moon", "sun", "earth's axis", "equator", "prime meridian", seq( choice("international date", "Mason-Dixon"), " line") ) );
   
  var reason = choice(
    seq("time zone legislation in ", choice("Indiana", "Arizona", "Russia")),
    "a decree by the pope in 1950s",
    geoReason,
    "magnetic field reversal",
    seq("an arbitrary decision by ", choice("Benjamin Franklin", "Isaac Newton", "FDR")) );

  var consequence = choice(
    "it causes a predicticable increase in car accidents",
    "that's why we have leap seconds",
    "scientists are really worried",
    seq("it was even more extreme during the ", choice("Bronze Age", "ice age", "Cretaceous", "1990s")),
    seq("there is a proposal to fix it, but it ", choice("will never happen", "actually makes things worse", "is stalled in Congress", "might be unconstitutional")),
    "it's getting worse and no one knows why");

  return seq("Did you know that ", what, " ", willDo, " because of ", reason, "? Apparently ", consequence, "." );
};

function choice() {
  return arguments[Math.floor(Math.random()*arguments.length)];
};

function seq() {
  var sequence = "";
  for (var i = 0; i < arguments.length; i++) {
    sequence += arguments[i];
  }
  return sequence;
};

AkodoGilador
Posts: 7
Joined: Mon Sep 10, 2007 2:35 pm UTC
Location: Nottingham, UK

Re: 1930: "Calendar Facts"

Postby AkodoGilador » Wed Dec 20, 2017 11:24 am UTC

How many of the 156,000 facts (or 780,000 if you include the alt-text) are true?

Alex

User avatar
astrus
Posts: 12
Joined: Sat Oct 19, 2013 8:33 pm UTC
Location: Right under my hat ...oh you meant geographically? Germany

Re: 1930: "Calendar Facts"

Postby astrus » Wed Dec 20, 2017 12:43 pm UTC

"Did you know that Daylight Savings Time might happen twice this year because of eccentricity of the sun? Apparently it's getting worse and no one knows why." (While it may seem like trivia, it is now recognized as a major cause of World War I)

I'll spend the rest of my day trying to fit that into a conversation...

User avatar
Eule
Posts: 6
Joined: Wed Feb 20, 2008 11:11 am UTC
Location: United States

Re: 1930: "Calendar Facts"

Postby Eule » Thu Dec 21, 2017 9:27 am UTC

Doesn't anybody know how to write a C program anymore?

CAUTION: Contains encryption. Consult regulations before exporting.

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>

#define FACTOR (897/69)
#define OFFSET1 0x41
#define OFFSET2 0x61

int main(int argc, char **argv, char **env)
{
int i = 0;

int j = 0;

struct timeval tv;

char words[] = ".\0?\0" "1990s\0Apparently\0Arizona\0Benjamin Franklin\0Did you know that\0FDR\0Gregorian\0Indiana\0Isaac Newton\0Mason-Dixon\0Mayan\0Olympics\0Russia\0Shark Week\0Toyota Truck Month\0actually makes things worse\0a decree by the Pope in the 1500s\0an arbitrary decision by\0atomic clock in Colorado\0at the wrong time\0because of\0blood\0bronze age\0calendar\0cretaceous\0day\0daylight\0drifts out of sync with the\0earlier\0earliest\0earth's axis\0Easter\0eccentricity\0equator\0equinox\0every year\0fall\0happens\0happen twice\0harvest\0ice age\0international date\0iPhone\0is stalled in Congress\0it causes a predictable increase in car accidents\0it's getting worse and no one knows why\0it was even more extreme during the\0later\0latest\0leap\0libation\0libration\0line\0lunar\0magnetic field reversal\0might\0be unconstitutional\0moon\0not happen\0nutation\0obliquity\0of the\0precession\0prime meridian\0savings\0scientsts are really worried\0solstice\0spring\0summer\0sun\0sunrise\0sunset\0super\0that's why we have leap seconds\0the\0there's a proposal to fix it, but it\0this year\0time\0time zone legislation in\0will never happen\0winter\0year\0zodiac";

if(argc > 0)
  {
  for(i=0;argv[i]!=NULL;i++)
    {
    if(strlen(argv[i]) > 8 &&
       argv[i][0] == '-' &&
       argv[i][1] == '-' &&
       argv[i][2] == 'v' &&
       argv[i][3] == 'e' &&
       argv[i][4] == 'r' &&
       argv[i][5] == 's' &&
       argv[i][6] == 'i' &&
       argv[i][7] == 'o' &&
       argv[i][8] == 'n')
      {
      printf("calendarfacts (XKCD utils 0.1)\nCopyright (C)"
             " 2017 Eule\nNo warranty.  If it breaks you ge"
             "t to keep all the pieces.\nLicense GPLv3+:\n");
      system("/usr/bin/lynx -dump 'https://www.gnu.org/licenses/gpl-3.0-standalone.html'");
      exit(1);
      }
    }
  }

for(i=0;env[i]!=NULL;i++)
  {
  if(!strcmp(env[i], "CALENDARFACTSOPTS=CRYPT"))
    {
    for(j=0;j<sizeof(words);j++)
      {
      if((words[j] > '@') && (words[j] < '['))
        {
        words[j] -= OFFSET1;
        words[j] = ((words[j] + FACTOR) % (2*FACTOR));
        words[j] += OFFSET1;
        }
      if((words[j] > '`') && (words[j] < '{'))
        {
        words[j] -= OFFSET2;
        words[j] = ((words[j] + FACTOR) % (2*FACTOR));
        words[j] += OFFSET2;
        }
      }
    }
  }

gettimeofday(&tv, NULL);

srand48(tv.tv_sec + tv.tv_usec);

printf("%s ", words + 47);

switch(labs(lrand48()) % 9)
  {
  case 0:
    printf("%s %s %s", words + 960,
                       labs(lrand48()) % 2 ? words + 460 : words + 889,
                       words + 441);
    break;

  case 1:
    printf("%s %s %s", words + 960,
                       labs(lrand48()) % 2 ? words + 1059 : words + 896,
                       labs(lrand48()) % 2 ? words + 880 : words + 118);
    break;

  case 2:
    printf("%s %s %s", words + 960,
                       labs(lrand48()) % 2 ? words + 391 : words + 683,
                       labs(lrand48()) % 2 ? words + 907 : words + 915);
    break;

  case 3:
    if(labs(lrand48()) % 2)
      {
      words[849] = '\0';
      }
    printf("%s %s %s", words + 346, words + 843, words + 1011);
    break;

  case 4:
    printf("%s %s", words + 690,
                    labs(lrand48()) % 2 ? words + 342 : words + 1066);
    break;

  case 5:
    printf("%s", words + 413);
    break;

  case 6:
    printf("%s ", words + 960);
    switch(labs(lrand48()) % 3)
      {
      case 0:
        printf("%s", words + 486);
        break;

      case 1:
        printf("%s", words + 922);
        break;

      case 2:
        printf("%s", words + 305);
        break;
      }
    printf(" %s", words + 775);
    break;

  case 7:
    printf("%s", words + 145);
    break;

  case 8:
    printf("%s", words + 134);
    break;
  }

switch(labs(lrand48()) % 3)
  {
  case 0:
    printf(" %s ", words + 465);
    switch(labs(lrand48()) % 3)
      {
      case 0:
        printf("%s", words + 383);
        break;

      case 1:
        printf("%s", words + 677);
        break;

      case 2:
        printf("%s", words + 276);
        break;
      }
    printf(" %s", words + 449);
    break;

  case 1:
    printf(" %s ", words + 355);
    switch(labs(lrand48()) % 5)
      {
      case 0:
        printf("%s", words + 903);
        break;

      case 1:
        printf("%s", words + 775);
        break;

      case 2:
        printf("%s", words + 1071);
        break;

      case 3:
        printf("%s %s", labs(lrand48()) % 2 ? labs(lrand48()) % 2 ? words + 69 : words + 112 : labs(lrand48()) % 2 ? words + 719 : words + 521,
                        words + 322);
        break;

      case 4:
        printf("%s", words + 251);
        break;
      }
    break;

  case 2:
    printf(" %s %s %s", words + 749,
                        labs(lrand48()) % 2 ? words + 780 : words + 473,
                        words + 1001);
    break;
  }

printf(" %s ", words + 294);

switch(labs(lrand48()) % 5)
  {
  case 0:
    printf(" %s ", words + 1016);
    switch(labs(lrand48()) % 3)
      {
      case 0:
        printf("%s", words + 79);
        break;

      case 1:
        printf("%s", words + 21);
        break;

      case 2:
        printf("%s", words + 127);
        break;
      }
    break;

  case 1:
    printf("%s", words + 192);
    break;

  case 2:
    switch(labs(lrand48()) % 6)
      {
      case 0:
        printf("%s", words + 817);
        break;

      case 1:
        printf("%s", words + 704);
        break;

      case 2:
        printf("%s", words + 791);
        break;

      case 3:
        printf("%s", words + 695);
        break;

      case 4:
        printf("%s", words + 420);
        break;

      case 5:
        printf("%s", words + 800);
        break;
      }
    printf(" %s ", words + 810);
    switch(labs(lrand48()) % 7)
      {
      case 0:
        printf("%s", words + 775);
        break;

      case 1:
        printf("%s", words + 903);
        break;

      case 2:
        printf("%s", words + 400);
        break;

      case 3:
        printf("%s", words + 433);
        break;

      case 4:
        printf("%s", words + 828);
        break;

      case 5:
        printf("%s %s", words + 502, words + 714);
        break;

      case 6:
        printf("%s %s", words + 100, words + 714);
        break;
      }

    break;

  case 3:
    printf("%s", words + 725);
    break;

  case 4:
    printf("%s ", words + 226);
    switch(labs(lrand48()) % 3)
      {
      case 0:
        printf("%s", words + 29);
        break;

      case 1:
        printf("%s", words + 87);
        break;

      case 2:
        printf("%s", words + 65);
        break;
      }
    break;
  }

printf("%s  %s ", words + 2, words + 10);

switch(labs(lrand48()) % 6)
  {
  case 0:
    printf("%s", words + 551);
    break;

  case 1:
    printf("%s", words + 928);
    break;

  case 2:
    words[857] = '\0';
    printf("%s", words + 851);
    printf("%s", words + 410);
    printf("%s", words + 858);
    break;

  case 3:
    words[331] -= 32;
    printf("%s %s", words + 641,
                    labs(lrand48()) % 2 ? labs(lrand48()) % 2 ? words + 311 : words + 494 : labs(lrand48()) % 2 ? words + 331 : words + 4);
    break;

  case 4:
    printf("%s ", words + 964);
    switch(labs(lrand48()) % 4)
      {
      case 0:
        printf("%s", words + 1041);
        break;

      case 1:
        printf("%s", words + 164);
        break;

      case 2:
        printf("%s", words + 528);
        break;

      case 3:
        words[754] = ' ';
        printf("%s", words + 749);
        break;
      }
    break;

  case 5:
    printf("%s", words + 601);
    break;
  }

printf("%s\n", words);

exit(0);
}

User avatar
SecondTalon
SexyTalon
Posts: 25964
Joined: Sat May 05, 2007 2:10 pm UTC
Location: Louisville, Kentucky, USA, Mars. HA!
Contact:

Re: 1930: "Calendar Facts"

Postby SecondTalon » Thu Dec 21, 2017 1:23 pm UTC

oi. Don't use red. Red's reserved for... well, this sort of thing.
heuristically_alone wrote:I want to write a DnD campaign and play it by myself and DM it myself.
heuristically_alone wrote:I have been informed that this is called writing a book.

User avatar
chridd
Has a vermicelli title
Posts: 813
Joined: Tue Aug 19, 2008 10:07 am UTC
Location: ...Earth, I guess?
Contact:

Re: 1930: "Calendar Facts"

Postby chridd » Sat Dec 23, 2017 9:32 am UTC

Eule wrote:CAUTION: Contains encryption. Consult regulations before exporting.
Ah, good old ROT897/69...
~ chri d. d. /tʃɹɪ.di.di/ (Phonotactics, schmphonotactics) · she(?)(?(?)(?))(?(?(?))(?))(?) · Forum game scores
Avatar: Lilac from Freedom Planet until someone posts in the avatar game
mittfh wrote:I wish this post was very quotable...
flicky1991 wrote:In both cases the quote is "I'm being quoted too much!"


Return to “Individual XKCD Comic Threads”

Who is online

Users browsing this forum: AlgaeSea, Archgeek, Old Bruce, pkcommando, PM 2Ring, Reka and 19 guests