Skip to main content

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

Release files for doomsday 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for doomsday 1.2.2
File Size Uploaded
doomsday-1.2.2.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for doomsday 1.2.2
File Interpreter ABI Platform
doomsday-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.7 kB

Release files / doomsday-1.2.2.tar.gz

Download URL doomsday-1.2.2.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
63cd123a67c8c49325c3aa0d8f7ebe818f8af45ad1db45aabf612923b3db874a
BLAKE2b-256 checksum
How to use checksums
60fce60c5cc1ce9c5a7d4cc572db4e5bc499291a4bcdc4be6a317bd9118131ee
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / doomsday-1.2.2-py3-none-any.whl

Download URL doomsday-1.2.2-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7a8031f0d2d2651e69d45bf536056191c67e7be70997e4354f63ced1cf58576
BLAKE2b-256 checksum
How to use checksums
d9ca2896d6db89544dd1f1475f689c4ebc9e2d055959b01ab466990ed8ac49f5
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.2

2 release files

1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page