Show HN:一款可在終端中運行的、擁有數千個球體的互動式物理模擬器

Show HN:一款可在終端中運行的、擁有數千個球體的互動式物理模擬器

Hacker News·

一位開發者在 Hacker News 上分享了名為 'ballin' 的專案,這是一款用 Rust 編寫的、可在終端中運行的彩色互動式 TUI 物理模擬器,能夠模擬數千個球體並展現真實的物理效果。該專案的開發得到了 Claude Opus 4.5 的顯著協助。

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

To see all available qualifiers, see our documentation.

Uh oh!

There was an error while loading. Please reload this page.

A colorful interactive physics simulator with thousands of balls, but in your terminal!

License

Uh oh!

There was an error while loading. Please reload this page.

minimaxir/ballin

Folders and files

Latest commit

History

Repository files navigation

ballin

Image

Crates.io

A colorful interactive physics simulator with thousands of balls, but in your terminal!

ballin is a fun TUI app written in Rust that simulates thousands of logical balls, but despite the inherent character constraints of a terminal, you can see the realistic physics of the balls in action:

Watch the color explosion in action!

Disclosure: This crate was developed with the assistance of Claude Opus 4.5 initially to answer the shower thought "would the Braille Unicode trick work to visually simulate complex ball physics in a terminal?" Opus 4.5 one-shot the problem, so I decided to further experiment to make it more fun and colorful. The full list of prompts used with Claude Code is present in PROMPTS.md.

Installation

The app binaries can be downloaded from the Releases page for your platform of choice, or by using the following terminal commands:

For Windows, download and unzip the binary from here.

If Rust is installed, you can install the crate directly via cargo:

Example Usage

It is VERY strongly recommended to use a terminal emulator such as Ghostty as normal terminals may have their frame rates capped at 30 FPS and the output looks choppy. The app looks comparatively poor in the native macOS Terminal.app, for example.

To run ballin: if you downloaded the binary, run it in the terminal with ./ballin. If you installed via Rust, run cargo run. The physics simulation will start with some shape objects randomly present to let the hilarity ensue immediately!

Press keys, click areas, see what happens? You can press ? for the full list of keyboard shortcuts.

Balls can be added to the machine by clicking the upper area: you can also hold Space to drop balls from all areas, or Shift+1/2/3/4/5/6 to drop balls in a specific section. You can also open Options to change the number of balls manually to a specified value, or Reset to return to the base number of balls.

For terminal compatability and accessibility reasons, Color Mode is disabled by default. To toggle it, just click the appropriately colorful Colors button (or press c) and the colors will appear! When triggering a geyser, it will color all affected balls the corresponding color.

Shapes can be inserted from the Shape menu. You can also click a Shape to select it: use the arrow keys to move a selected shape, press n/m to cycle through colors for the shape, or click-and-hold to drag the shape around.

Levels, which include options and shape objects, can be exported using Save and loaded using Load. The ballin level used in the video above is available in the level.json file.

You can also use the CLI arguments of --color to enable color by default, or --balls 10000 to increase the default number of starting balls.

Notes

Maintainer/Creator

Max Woolf (@minimaxir)

Max's open-source projects are supported by his Patreon and GitHub Sponsors. If you found this project helpful, any monetary contributions to the Patreon are appreciated and will be put to good creative use.

License

MIT

About

A colorful interactive physics simulator with thousands of balls, but in your terminal!

Resources

License

Uh oh!

There was an error while loading. Please reload this page.

Stars

Watchers

Forks

Releases

  3

Sponsor this project

Uh oh!

There was an error while loading. Please reload this page.

Image

Packages

  0

Languages

Footer

Footer navigation

Hacker News

相關文章

  1. Show HN:Miditui – 一款藉助 AI 開發的終端 MIDI 編曲、混音與播放應用

    3 個月前

  2. Show HN:Tylax - 一款基於 Rust 的雙向 LaTeX 至 Typst 轉換器

    4 個月前

  3. Show HN:Interminai - 讓 AI 驅動 TTY 的互動式終端機

    4 個月前

  4. weathr:一款具備即時 ASCII 動畫效果的終端機天氣應用程式

    2 個月前

  5. Show HN:使用光線投射技術的月球模擬遊戲

    17 天前