|
1 | 1 | rust_collatz_solution |
2 | 2 | ===================== |
3 | 3 |
|
4 | | -A high‑performance Collatz explorer with big‑integer support and a lightweight visualizer. |
| 4 | +Collatz explorer with big‑integers and a tiny live visualizer. One command to try it. |
5 | 5 |
|
6 | | -- Arbitrary precision via `num-bigint::BigUint` (explores up to 2^2000 and beyond) |
7 | | -- O(1) memory cycle detection (Floyd’s algorithm) |
8 | | -- Random‑shot mode by default across [2^68, 2^2000−1] |
9 | | -- Minimal disk writes: only writes `solution.txt` when a finding occurs |
10 | | -- Optional 500×500 GUI (minifb) animates trajectories and shows the current seed |
| 6 | +<img width="500" height="531" alt="Visualizer" src="https://github.com/user-attachments/assets/05894ec5-fdf6-407f-ba98-85f0ee8044a4" /> |
11 | 7 |
|
12 | 8 | Quick Start |
13 | 9 | ----------- |
14 | 10 |
|
15 | | -- Run with defaults (random scanning + viz): |
| 11 | +- Easiest: run with the defaults (random + viz) |
16 | 12 | - `cargo run --release --` |
17 | | -- More frequent visualization updates: |
| 13 | +- Want more motion? draw more often |
18 | 14 | - `cargo run --release -- --viz-interval 100 --viz-max-steps 3000` |
19 | | -- Sequential (no random), starting at a value: |
| 15 | +- Sequential (no random), start from a value |
20 | 16 | - `cargo run --release -- --no-random --start 100000000000000000000` |
21 | 17 |
|
22 | | -Note: When using `cargo run`, pass program flags after `--` so Cargo doesn’t parse them. |
| 18 | +Tip: when using `cargo run`, put program flags after `--`. |
23 | 19 |
|
24 | | -CLI Flags |
25 | | ---------- |
| 20 | +What it does |
| 21 | +------------ |
26 | 22 |
|
27 | | -- `--start <DECIMAL>`: starting value (decimal string); used when `--no-random`. |
28 | | -- `--count <N>`: stop after testing N starts (for experiments/testing). |
29 | | -- `--solution <PATH>`: path for the single‑line solution file (default `solution.txt`). |
30 | | -- `--random` / `--no-random` (default `--random`): random shots vs sequential scan. |
31 | | -- `--viz` / `--no-viz` (default `--viz`): enable/disable the visualizer. |
32 | | -- `--viz-interval <N>`: send a new seed to the GUI every N starts (default 1000). |
33 | | -- `--viz-max-steps <N>`: sliding window width for the animated line (default 10,000). |
| 23 | +- Scans huge numbers (BigUint, up to 2^2000+) |
| 24 | +- Detects loops/runaways with O(1) memory |
| 25 | +- Writes to disk only when a finding occurs (`solution.txt`) |
| 26 | +- Visualizer shows the current line and the number being tested |
34 | 27 |
|
35 | | -Output |
36 | | ------- |
| 28 | +Handy flags |
| 29 | +----------- |
37 | 30 |
|
38 | | -- `solution.txt`: written and fsynced on first finding, then the app exits. |
39 | | - - Formats: `NONTRIVIAL_CYCLE_START <n>` or `RUNAWAY_STEPS_OVERFLOW_START <n>`. |
| 31 | +- `--random` / `--no-random` (default: random on) |
| 32 | +- `--viz` / `--no-viz` (default: viz on) |
| 33 | +- `--viz-interval <N>`: send a new seed to the GUI every N starts (default 1000) |
| 34 | +- `--viz-max-steps <N>`: line window width (default 10_000) |
| 35 | +- `--start <DECIMAL>` and `--count <N>` for sequential runs |
40 | 36 |
|
41 | 37 | Releases |
42 | 38 | -------- |
43 | 39 |
|
44 | | -This repo includes a GitHub Actions workflow that builds and publishes archives per commit (tagged by short SHA) for: |
| 40 | +GitHub Actions builds downloadable archives per commit (named by short SHA) for: |
45 | 41 |
|
46 | 42 | - Linux x86_64 (GNU) |
47 | 43 | - Windows x86_64 (MSVC) |
48 | 44 | - Windows i686 (MSVC) |
49 | 45 |
|
50 | | -Each archive includes the compiled executable. See the Releases tab for downloads. |
| 46 | +Download from Releases and run the executable. That’s it. |
0 commit comments