Hacker News new | past | comments | ask | show | jobs | submit login
Cbonsai: Grow bonsai trees in your terminal (gitlab.com/jallbrit)
361 points by throwaway888abc on March 3, 2021 | hide | past | favorite | 63 comments



This is actually pretty cute, I just wish there was perhaps a "patience" mode that would just be a slower version of the screensaver mode. I'd love to leave this on my second display and let it grow over the course of an hour or a work day.


I'll give you one better, I wrote a plant life simulator that takes place over 4 or 5 days: https://github.com/jifunks/botany


I love this on tilde.town. Every morning I log in and water my plant and also check in on the plant of one other guy who saved my plant once.


I can lend you my tamagotchi? ;-)


That looks cool, I'll grab it when I get some free time


Take it even further, save the seed, use the system time, and when you open it show the current state of the tree which grows on the span of years/months


There's a --time parameter for the delay between each step. You'd have to figure out roughly how many steps it takes to build a tree though.


Doesn't this option solve it?

    -t, --time=TIME        in live mode, wait TIME secs between steps of growth


Yep! I just figured out that I would need a combination of flags to get it to work the way I wanted, thank you for the help. Aliasing the whole command has basically given me all the functionality I could ask for.


Could you share the command?


Sure, I'm using 'cbonsai -i -l -t 5 -b 1'

You can change the number to 10 if you want an even slower one, but 5 was good for me.


Cool! I set it up on Repl.it. Just hit run to try it: https://repl.it/@amasad/cbonsai


Very interesting. My initial thought was that this should be something that runs in the background and grows very slowly, and then you could check it from time to time by running `cbonsai` from the console, or have it show on your desktop or screen saver. You know, kind of like a real plant, but it grows slightly faster and you have no maintenance.


This was my thought as well. I feel like there should be a mode for this.


Nice one, unfortunately there are so little contemplating games, i would love a dwarf fortress style game running in my background , with almost no gameplay intervention.

watching the rise and fall on an empire/colony.

There are galimulatore and worldbox, but we need more.


I love these types of games. Some options:

- Paradox games in spectate mode. You begin to see flaws in the model where nations conquer & hold in implausible ways which leads to stagnation, but still an interesting model.

- Gridworld on Steam: https://store.steampowered.com/app/396890/Gridworld/

- AIbattle on Youtube: https://www.youtube.com/channel/UC6oT1a9Kqfor47HA3_ItCjQ

- Cell Lab on Android: https://cell-lab.net/

I would enjoy a passive zero player game like this that then has a game aspect as a meta layer where players compete in betting markets on making the most accurate predictions of the model.


Kinda reminds me of SimAnt, which if I recall correctly would basically play itself but you could 'help' by throwing down food or digging tunnels for the ants.


Not sure if it fits the bill exactly, but globulation2 comes close to what you describe. Sometimes it feels more of a simulation than a game.


You might be interested in biogenesis, a 0-player game that simulates evolution at microorganism scale.


Very neat!

For a deeper appreciation, check out "The Algorithmic Beauty of Plants": http://algorithmicbotany.org/papers/#abop


My first CS assignments were based on this book. Using linked lists in C + opengl we made some pretty nice looking trees.

If not for this book and assignments, I would probably have switched to another major.


If you're on Ubuntu 18.04 trying to build from source, the readme says "sudo apt install ncurses", but I had to do "sudo apt install libncurses-dev". It's a fun little program, I like it a lot.


Thanks for this, someone reached out and showed me this comment so I fixed the installation instructions.


Hey, I'm the one that built this! Thanks for sharing with this community, and it was nice to read all your kind comments!


Hello! Thank you for crediting me btw! :) I was very pleased to see this on HN today.

My site's down at the moment, but the JS version is now back online on GitHub:

https://avelican.github.io/bonsai/

I will update it to link to your new projects!


Hey- it's so cool to re-connect after these couple years! I was also pleased to see this... it wasn't even me that posted it! I'll update my README to link to your new URL- thanks for linking to my projects!


Absolutely adorable, it goes straight into my “games” category with `bb` and `oneko`. As it only takes a minute, is good practice, and may be helpful for others, here is a quick minimal Nix expression:

    # vim: set ts=8 sw=2 sts=2 et:
    #
    # nix-build --no-out-link -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'
    
    { pkgs ? import <nixpkgs> { }, ncurses, pkg-config, stdenv }:
    stdenv.mkDerivation rec {
      version = "1.0.0";
      pname = "cbonsai";
      src = pkgs.fetchFromGitLab {
        owner = "jallbrit";
        repo = pname;
        rev = "v${version}";
        sha256 = "1jc34j627pnyjgs8hjxqaa89j24gyf0rq9w61mkhgg0kria62as7";
      };
      nativeBuildInputs = [ pkg-config ];
      buildInputs = [ ncurses ];
      installFlags = [ "PREFIX=$(out)" ];
    }



Thank you very much, I just did not want to stand as maintainer unless I ended up using it frequently and deeply appreciate that you “stepped up”. =)


Yep, that was definitely a vimsai. Different pruning technique :qp:


I was googling bonsai trees earlier today to add some greenery the my desk. Guess I don't need to bother now, just find a spare screen and fire this up.


Most bonsai trees do not like indoors so keep that in mind


Grow lights help. But the one I had survived well until it wasn’t watered during a longer trip with a north facing window in the US south. So it got very little direct light.


Yea thats what my research also said. So given up on the indoor idea. I live in the UK. Sun is a luxury :-(


Fair enough. Like I said, mine was doing well until a house sitter didn't show up to water it while I was gone. It never quite recovered from that. But it did well for the 2 prior years. Now that I have a house with south facing windows I want to get another one but haven't yet, also the cats my wife wanted have a tendency to eat plants so I'll need a cage for the poor tree or it'll be wrecked.


This is really neat, would be interesting if someone turned it into a terminal version of a productivity app like Forest.

https://apps.apple.com/us/app/forest-stay-focused/id86645051...


We need more stuff like that


Please see if you can get a trusted user to add this to the official Arch repos. Not that I won't install and use an AUR, but I'm trying my best to limit the AURs I use these days.


This somehow made me feel that I should take up Dwarf Fortress again.


Maybe you'd be interested in Rimworld? It's not free, but it does a great job of bringing Dwarf-Fortress into the 21st century, both figuratively and literally. I'm a fan of both games, but the modding community behind Rimworld already challenges the 20 years of Dwarf Fortress content around. Really impressive stuff, and a fun game overall.


I love rimworld, and have never been able to get into dwarf fortress properly, but I'd characterize DF as way more advanced than rimworld in terms of mechanics and simulation. Rimworld sacrifices a lot of complexity in favor of a simpler UI and a more streamlined game. I haven't modded rimworld to oblivion yet, but I don't think you can e.g. make rimworld 3D in any convincing sense through mods.

That said, I recommend rimworld anyway.


in case you are not aware, Dwarf Fortress is getting an official UX and graphical makeover which will be released on Steam: https://store.steampowered.com/app/975370/Dwarf_Fortress/


I’m going to port this to Python for use as a progress bar ala tqdm.


Man, I haven't heard of ncurses in ages. I wrote my first C game using ncurses. Cool project, thanks for sharing.


Omg, this not only looks like a bonsai but also as a bash fork bomb :D Who will execute it first? :D


Oh this is really neat. Gonna play with it.

Making terminal animations is a ton of fun. I built matrix rain since I was a huge fan of the movie.

Shameless plug: https://github.com/nojvek/matrix-rain


I remember when this was bonsai.sh, a couple years ago. I love having a little tree in my terminal.


Shameless self plug: we also planted a tree in the arctic using a similar method!

https://github.com/tmf-code/arctic-tree


Hmm, a pruning feature would be in demand methinks (depending on timescale)


I feel like a pruning feature would be essential to make it really bonsai!


> cbonsai is a bunch of if statements homemade algorithm


Would it be possible to pass a shell command to the message argument so it is executed each time a new tree is starting to grow?


Yes that's possible! Just call it like so: `cbonsai -m "$(fortune)"` or whatever program you want


Thanks!


Oh I'm disappointed this doesn't grow over time like a tamagotchi. And you have to water and prune it.


This is great


unable to get this running on macOS... anyone else having issues?


Hey, I'm the creator. Can you share what errors you're getting?


Hey there, was getting linker errors because panel.pc wasn't in Pkg-config. Turns out installing ncurses with homebrew gives you ncurses v6 which doesn't have .pc files.

https://mrcook.uk/how-to-install-go-ncurses-on-mac-osx ^ this guide is really helpful and explains how to fix the issue


Super cool program by the way!


Hi



Welcome to Hacker News.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: