cbonsai is a bonsai tree generator, written in C using ncurses
cbonsai is a bonsai tree generator, written in C using ncurses
You can now brew install cbonsai as its in the main brew repo, please see https://github.com/Homebrew/homebrew-core for updates
cbonsai is a bonsai tree generator, written in C using ncurses. It intelligently creates, colors, and positions a bonsai tree, and is entirely configurable via CLI options-- see usage. There are 2 modes of operation: static (the default), and live. See modes for details.
cbonsai is always looking for ideas for improvement- feel free to open an issue if you've got an idea or a bug!
AUR user nichobi has kindly packaged cbonsai in the AUR, called cbonsai-git. It can be installed via an AUR helper, e.g. yay:
yay -S cbonsai-gitbrew install mhzawadi/cbonsai/cbonsai
Or brew tap mhzawadi/cbonsai and then brew install cbonsai.
brew help, man brew or check Homebrew's documentation.
You'll need to have a working ncurses library. If you're on a Debian-based system, you can install ncurses like so:
sudo apt install ncursesEnsure dependencies are met, then to install:
git clone https://gitlab.com/jallbrit/cbonsai
cd cbonsai
make install…Try out -S/--screensaver mode! As the help message states, it activates the --live and --infinite modes, quits upon any keypress, also saves/loads using the default cache file (~/.cache/cbonsai). This means:
cbonsai with --screensaver, a tree (including its seed and progress) is loaded from the default cache file.cbonsai and --screensaver was on, the current tree being generated (including its seed and progress) is written to the default cache file.This is helpful for a situations like the following: let's say you're growing a really big tree, really slowly:
$ cbonsai --screensaver --life 40 --multiplier 5 --time 20 --screensaverNormally, when you quite cbonsai (e.g. by you hitting q or ctrl-c), you would lose all progress on that tree. However, by specifying --screensaver, the tree is automatically saved to a cache file upon quitting. The next time you run that exact same screensaver command:
$ cbonsai --screensaver --life 40 --multiplier 5 --time 20 --screensaverThe tree is automatically loaded from the cache file! And, since infinite mode is automatically turned on, it will finish the cached tree and just keep generating more. When you quit cbonsai again, the tree is once again written to the cache file for next time.
Keep in mind that only the seed and number of branches are written to the cache file, so if you want to continue a previously generated tree, make sure you re-specify any other options you may have changed.
.bashrcFor a new bonsai tree every time you open a terminal, just add the following to the end of your ~/.bashrc:
cbonsai -pNotice it uses the print mode, so that you can immediately start typing commands below the bonsai tree.
cbonsai starts by drawing the base onto the screen, which is basically just a static string of characters. To generate the actual tree, cbonsai uses a bunch of if statements homemade algorithm to decide how the tree should grow every step. Shoots to the left and right are generated as the main trunk grows. As any branch dies, it branches out into a bunch of leaves.
cbonsai has rules for which character and color it should use for each tiny branch piece, depending on things like what type of branch it is and what direction it's facing.
The algorithm is tweaked to look best at the default size, so larger sized trees may not be as bonsai-like.
This project wouldn't be here if it weren't for its roots! cbonsai is a newer version of bonsai.sh, which was written in bash and was itself a port of this bonsai tree generator written in javascript.
No open issues yet, or sync has not completed.