feat(tui): a slot machine for anyone who cannot decide - #9
Merged
Merged
Conversation
…ecide The three questions the picker asks are three reels of a slot machine, stopping left to right because that is the order they depend on each other in: the provider reel is filled from the harness that just landed, and the model reel turns on placeholders until the catalogue lookup for that provider answers. The wait for the network became the animation rather than a spinner in front of it. The lucky line is a button, so the menu now enables mouse capture, and the draw records where the line ended up: the footer sits under a body whose height is only known once the frame is laid out, and a click knows a row and a column and nothing else. Ctrl+L pulls the same lever, because a plain letter is typed into the model filter. Nothing launches on its own: the payout screen shows the three answers and waits for enter, esc puts the rolls back in the menu.
slots.rs sized every column from a 22-wide const, which stumped a long model id on a wide screen and overflowed a narrow one. every size now comes from Geo::fit(area): wider terminal, wider reels up to MAX_CELL; taller terminal, deeper drums. under the width that keeps a reel legible the handle margin goes rather than the reels, and the banner names the space bar instead.
…fills the screen one row per frame read as a list being replaced. slots.rs now owns the spin: a fractional offset winding up to TOP_SPEED, blurring into symbols past BLUR_SPEED, easing onto its row through settle(), a back-out curve overshooting under a row. all three drums go on the pull and stop left to right, the provider reel refilled mid-spin without losing its motion. the cabinet lights from the payline outwards (View::boot), the handle is a knob on a rod in a track with a sprung return (View::lever), Geo::fit takes the whole terminal.
`MAX_REACH` 3 and `MAX_CELL` 30: at 140x34 the machine is nineteen rows tall and centred, with room left around it. `Reel::face` no longer swaps names for casino symbols at speed. the swap hid the only thing worth watching, the answers going past. `TOP_SPEED` drops to eleven rows a second and the payline runs cyan, white on landing. `brake_to` now arms rather than brakes: `Spin::Arming` holds full speed until the row is `BRAKE_ROWS` away, then `land` times the curve off `ENTRY_SLOPE` so it leaves at the speed the drum was turning. list length no longer changes the landing, and the brake no longer opens with a lurch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
src/slots.rsis a three reel slot machine reached from afeeling luckyline at the bottom of the menu, insrc/tui.rs. it rolls harness, then provider, then model, and lands on a picked launch: enter fires it, space re-rolls, esc leaves with nothing spent. it is an easter egg and it is deliberately undocumented.nothing turns until the handle is pulled, with space or a click on it. the provider reel is refilled from the harness that just landed, and the model reel keeps turning until
load_modelsanswers, bounded by the same twenty second ceiling the command line path uses.Geo::fitmeasures the cabinet against the drawing rect every frame rather than holding a fixed size, so a long model id is shown instead of a stump and the handle margin is the first thing dropped on a narrow terminal, where the space bar replaces it. the dice are a splitmix64 seeded offSystemTime, so no new dependency.cargo fmt,cargo clippy --all-targets --all-features -- -D warningsandcargo testpass on the new head, 118 tests.