Calculating weekdays and dates with Go

Stage Fright

The preparations are complete, and your training program can begin! Advanced students are also welcome to extend the program by training for several changing years with different Doomsdays. If you want to simulate the time pressure that a magician experiences in front of an impatient audience, you can add a progress bar [3] to the game as an additional stress factor; this leaves the candidate only a short time to choose the day of the week. If the time expires, the score drops to zero points, which you could even accompany by a game show klaxon sound by playing an appropriate sound file. Enjoy!

Infos

  1. "Perl Script Reveals Math Trick" by Mike Schilli, Linux Magazine, issue 87, February 2008, p. 80
  2. Doomsday rule: https://en.wikipedia.org/wiki/Doomsday_rule
  3. "Develop a DIY Progress Bar" by Mike Schilli, Linux Magazine, issue 220, March 2019, pp. 46-49
  4. Listings for this article: ftp://ftp.linux-magazine.com/pub/listings/linux-magazine.com/227/
  5. Leap second: https://en.wikipedia.org/wiki/Leap_second

The Author

Mike Schilli works as a software engineer in the San Francisco Bay area, California. Each month in his column, which has been running since 1997, he researches practical applications of various programming languages. If you email him at mailto:mschilli@perlmeister.com he will gladly answer any questions.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Command Line: cal and date

    The legacy cal and date tools help users keep track of the time and date. You can even change the system time with a single shell command.

  • SuperKaramba Workshop

    If you can’t find the SuperKaramba theme you’re looking for, you can always build your own.

  • Programming Snapshot – Mileage AI

    On the basis of training data in the form of daily car mileage, Mike Schilli's AI program tries to identify patterns in driving behavior and make forecasts.

  • At a Glance

    Using extensions in Go and Ruby, Mike Schilli adapts the WTF terminal dashboard tool to meet his personal needs.

  • Perl: Math Tricks

    A trick that anybody can learn lets you determine the day of the week from the date. We’ll apply some Perl technology to discover whether the method is reliable.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News