Skip to main content

A command line Doomsday rule utility and trainer

Project description

doomsday: a Doomsday rule utility and trainer

PyPI Changelog Tests License

A simple command line utility implemented in Python for practicing mental calculation of the day of the week for dates in the Gregorian calendar, using the Doomsday rule algorithm originally described by John Horton Conway [1]. This implementation relies on recent improvements to the algorithm by Chamberlain Fong and Michael K. Walters [2] that reduce the complexity of the mental calculation, as well as on the formula for calculating the anchor day for a century described in the Wikipedia entry for the Doomsday rule [3].

$ doomsday --help
Usage: doomsday [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  dayofweek     Calculate the day of the week for DATE.
  doomscentury  Calculate the anchor day for the century of YEAR.
  doomsmonth    Calculate the doomsmonth for DATE.
  doomsyear     Calculate the doomsyear for YEAR.
  leapyear      Determine if YEAR is a leap year.
  test          Estimate your accuracy in calculating the day of the week.

$ doomsday leapyear --help
Usage: doomsday leapyear [OPTIONS] YEAR

  Determine if YEAR is a leap year.

Options:
  --explain  Provide a walkthrough of the calculation.
  --help     Show this message and exit.

$ doomsday doomscentury --help
Usage: doomsday doomscentury [OPTIONS] YEAR

  Calculate the anchor day for the century of YEAR.

Options:
  --explain  Provide a walkthrough of the calculation.
  --help     Show this message and exit.

$ doomsday doomsyear --help
Usage: doomsday doomsyear [OPTIONS] YEAR

  Calculate the doomsyear for YEAR.

Options:
  --explain  Provide a walkthrough of the calculation.
  --help     Show this message and exit.

$ doomsday doomsmonth --help
Usage: doomsday doomsmonth [OPTIONS] [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d
                           %H:%M:%S]

  Calculate the doomsmonth for DATE.

Options:
  --explain  Provide a walkthrough of the calculation.
  --help     Show this message and exit.

$ doomsday dayofweek --help
Usage: doomsday dayofweek [OPTIONS] [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d
                          %H:%M:%S]

  Calculate the day of the week for DATE.

Options:
  --explain  Provide a walkthrough of the calculation.
  --help     Show this message and exit.

$ doomsday test --help
Usage: doomsday test [OPTIONS]

  Estimate your accuracy in calculating the day of the week.

Options:
  --trials INTEGER RANGE  [1<=x<=100]
  --help                  Show this message and exit.

Requirements

Python 3.6 or later.

Installation

$ pip install doomsday

License

This code is provided under the terms of an MIT License. See the LICENSE file for the copyright notice.

References

[1] Berlekamp, E.R., Conway, J.H. and Guy, R. K. Winning Ways for your Mathematical Plays. Volume 2: Games In Particular. Academic Press, NY (1982).

[2] Fong, C. and Walters, M.K. Methods for Accelerating Conway's Doomsday Algorithm (part 2). ICIAM (2011).

[3] Wikipedia. Doomsday rule. Downloaded from http://en.wikipedia.org/wiki/Doomsday_rule (2012).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

doomsday-1.2.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

doomsday-1.2.2-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file doomsday-1.2.2.tar.gz.

File metadata

  • Download URL: doomsday-1.2.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.11

File hashes

Hashes for doomsday-1.2.2.tar.gz
Algorithm Hash digest
SHA256 63cd123a67c8c49325c3aa0d8f7ebe818f8af45ad1db45aabf612923b3db874a
MD5 6b69fbd16c512622ad2d3f8f026afaf3
BLAKE2b-256 60fce60c5cc1ce9c5a7d4cc572db4e5bc499291a4bcdc4be6a317bd9118131ee

See more details on using hashes here.

File details

Details for the file doomsday-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: doomsday-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.11

File hashes

Hashes for doomsday-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7a8031f0d2d2651e69d45bf536056191c67e7be70997e4354f63ced1cf58576
MD5 2b3d6642c0b16f7a4e31d107312220d1
BLAKE2b-256 d9ca2896d6db89544dd1f1475f689c4ebc9e2d055959b01ab466990ed8ac49f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page