https://gitlab.com/christosangel/hanoi
Hanoi is a simple terminal version of the known classical game Tower of Hanoi, written in Bash.
During the game, the user can move left and right, pick disks and drop them in other stacks.
The aim is to move all the disks from the ORIGIN pile to the DESTINATION pile, in as little moves as possible


12 Comments
M33@piefed.world · 31 pts · 75d
Impressive 🙂
Unsolicited Rust rewrite in 5…4…3…ðŸ¤
christos@lemmy.world · 3 pts · 75d
Rust away!🤠Actually it sounds reasonable, I guess in Rust 2D arrays are easier to work with than in Bash.
racketlauncher831@lemmy.ml · 2 pts · 75d
Why are you sharing your program with miniserve?
M33@piefed.world · 2 pts · 75d
I'm not sure to understand that question ?
christos@lemmy.world · 1 pts · 75d
I don't understand what you are asking, please elaborate.
racketlauncher831@lemmy.ml · 1 pts · 72d
No worries. My bad.
miniserve, a popular command line program written in Rust to serve static files, also counts down (from three though) before launching the server, just like he counts down from five before someone rewrites your Hanoi Tower game in Rust.
http://crates.io/crates/miniserve
7eter@feddit.org · 3 pts · 75d
nice - do you know why using h+l is so much faster than the arrow keys?
Marty_TF@lemmy.zip · 4 pts · 75d
bcs u dont need to put one hand on the arrow keys and have to use the other hand for the rest of the keyboard or alternatively jump around with ur hands
of course this isnt a huge factor in a little game but vim people are used to it. i was sceptical of vim keybinding at first but then i started using it and dam it is true that it's superior
7eter@feddit.org · 4 pts · 75d
Agreed! But I also noticed a significant performance difference (in the time that the game take to update the selected stack). It might be due to my lack in cli-gaming, but I never noticed something like that before.
christos@lemmy.world · 2 pts · 73d
This bug is now fixed, its origin was escape code parsing while using the arrow keys: looped three times before getting the input. You can update the script to get the improved version. As I said, it is now fixed, plus the max level of disks is up to 13.
Recursion until hell freezes over.
7eter@feddit.org · 2 pts · 65d
nice!
christos@lemmy.world · 1 pts · 75d
You noticed correctly, I made the trade off because I wanted to have an extra disk level available (10 instead of 9), but I believe it was not worth it. I updated the script, it is now quite snappier I think, check it out if you wish, and let me know what you think.
Thanks for the feedback.