this post was submitted on 10 Jun 2026
75 points (100.0% liked)

Linux Gaming

26210 readers
713 users here now

Discussions and news about gaming on the GNU/Linux family of operating systems (including the Steam Deck). Potentially a $HOME away from home for disgruntled /r/linux_gaming denizens of the redditarian demesne.

This page can be subscribed to via RSS.

Original /r/linux_gaming pengwing by uoou.

No memes/shitposts/low-effort posts, please.

Resources

Help:

Launchers/Game Library Managers:

General:

Discord:

IRC:

Matrix:

Telegram:

founded 3 years ago
MODERATORS
 

cross-posted from: https://lemmy.world/post/47988648

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

hanoi.png

you are viewing a single comment's thread
view the rest of the comments
[–] palordrolap@fedia.io 7 points 4 days ago (1 children)

If I correctly remember the minimum number of moves required to get all the disks from one tower to another, 10 layers is going to be a slog.

[–] christos@lemmy.world 7 points 4 days ago (2 children)

The minimum number of moves required to solve a Tower of Hanoi puzzle is 2**n − 1, where n is the number of disks. 1023 for 10 disks, 5011 for 9 disks (updated max disks in the game). Recursion to the max.

[–] besmtt@lemmy.world 4 points 4 days ago* (last edited 4 days ago) (1 children)

1023 for 10 disks, 5011 for 9 disks

More moves for less disks?

[–] christos@lemmy.world 7 points 4 days ago (1 children)

Yup, this is fat finger mathematics. The correct number is 511, somehow zero got in the way.

[–] besmtt@lemmy.world 3 points 4 days ago (1 children)
[–] christos@lemmy.world 2 points 3 days ago

I have just updated the script, now up to 13 disks available (optimal moves: 8191).

It will take a while to solve it...

[–] lornosaj@lemmy.world 1 points 4 days ago (1 children)

I might be just tired, but it took me a stupidly long second to get that minimum number of moves formula - not to nitpick, but isn’t that exp. usually written as 2^n - 1 ?

[–] christos@lemmy.world 3 points 4 days ago (1 children)

I don't know, it is not often that I use exp in writing, however:

$ echo $((2**9-1))
[–] lornosaj@lemmy.world 3 points 4 days ago (1 children)
[–] christos@lemmy.world 1 points 4 days ago