Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hiimsergey/hundred-doors
A tool for calculating and visualizing the '100 Doors' problem
https://github.com/hiimsergey/hundred-doors
cli cli-app math mathematics ncurses ncurses-tui rust rust-lang rust-practice rust-programming rust-programming-language rustlang
Last synced: about 2 months ago
JSON representation
A tool for calculating and visualizing the '100 Doors' problem
- Host: GitHub
- URL: https://github.com/hiimsergey/hundred-doors
- Owner: hiimsergey
- Created: 2024-01-25T18:22:27.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2024-11-13T16:58:26.000Z (about 2 months ago)
- Last Synced: 2024-11-15T02:09:39.723Z (about 2 months ago)
- Topics: cli, cli-app, math, mathematics, ncurses, ncurses-tui, rust, rust-lang, rust-practice, rust-programming, rust-programming-language, rustlang
- Language: Rust
- Homepage: https://crates.io/crates/hundred-doors
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 100 Doors
> Imagine a hundred closed doors in a corridor.
> You go and open every one of them.
> Then, you open every second one. (If the door was open, then just close it.)
> Then, every third. Then, every fourth and every fifth and so on until you only touch the 100th door.
> How many doors are open now?This is a mathematical problem known as "100 Doors". I have written a smol
program in Rust that calculates and visualizes the solution using
[ncurses-rs](https://crates.io/crates/ncurses).```
A simple program that calculates and visualizes the "100 Doors" problemUsage: hundred-doors [OPTIONS] [NUMBER]
Arguments:
[NUMBER] How many doors there are [default: 100]Options:
-d, --draw Whether there should be a graphical representation of these doors
-e, --explain Whether to explain the problem
--twave How many milliseconds to wait before the next wave [default: 0]
--tdoor How many milliseconds to wait between new doors [default: 0]
-h, --help Print help
-V, --version Print version
```## Examples
```
$ hundred-doors 100
> 10
``````
$ hundred-doors 100 --draw --tdoor 10 --twave 50
```You'll see an "animation" of the respective doors. Here's a screenshot:
![hundred-doors-screenshot](https://github.com/hiimsergey/hundred_doors/assets/91432388/4e5e72bb-333c-4c28-b46f-e6f5f1055ee8)