23 releases (stable)
2.0.8 | Sep 26, 2024 |
---|---|
2.0.5 | Feb 22, 2024 |
2.0.4 | Jul 30, 2023 |
2.0.1 | Mar 28, 2023 |
0.1.1 | Dec 28, 2020 |
#52 in Games
1,009 downloads per month
86KB
991 lines
About
Shakuntala Devi's trainer is a brain training tool available as a GUI, a text console version and also an experimental online version thank to the cross platform GUI library Iced.
shakuntala-devi-trainer is an EDLA project.
The purpose of edla.org is to promote the state of the art in various domains.
Installation
cargo install shakuntala-devi-trainer
Usage
The goal is to determine the day of the week for a given date.
The technic used by Shakuntala Devi is describe in her book Figuring the Joy of Numbers.
You can see an overview in Tibee's video India's Human Computer or in this livejournal entry
To launch the GUI
shakuntala-devi-trainer
To launch the text console version
shakuntala-devi-trainer --cli
If you use the console version your answer should be encoded as an integer like described in the book like so :
- Sunday 0
- Monday 1
- Tuesday 2
- Wednesday 3
- Thursday 4
- Friday 5
- Saturday 6
If your answer is wrong only the text console version will give you a hint for now.
Each hint is the result of a step of Shakuntala Devi's algorithm.
You can adjust the range of the random date with two handy sliders.
Tips
In the Gregorian calendar, three criteria must be taken into account to identify leap years:
- The year must be evenly divisible by 4;
- If the year can also be evenly divided by 100, it is not a leap year;
- unless... The year is also evenly divisible by 400. Then it is a leap year.
According to these rules, the years 2000 and 2400 are leap years, while 1800, 1900, 2100, 2200, 2300, and 2500 are not leap years.
Web version
You can try the online version shakuntala-devi-trainer or built it yourself :
rustup target add wasm32-unknown-unknown
cargo install -f wasm-bindgen-cli
cargo build --release --target wasm32-unknown-unknown
wasm-bindgen target/wasm32-unknown-unknown/release/shakuntala-devi-trainer.wasm --out-dir shakuntala-devi-trainer --web
Alternate systems for mentally calculating the day of the week for any given date.
https://mattbaker.blog/2020/04/26/mental-math-and-calendar-calculations/
Developer Notes
- Modulo of negative numbers shows languages in two different camps.
- Rust conveniently allow infinite lazy stream with iterator
- num-traits is required for Weekday::from_u32
- By default Rust test programs hide the stdout of successful tests
- Rust built-in test framework does not support parameterized tests
License
© 2020-2024 Olivier ROLAND. Distributed under the GPLv3 License.
Dependencies
~43–83MB
~1.5M SLoC