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

all 11 comments

sorted by: hot top controversial new old
[–] 7 points 5 months ago (9 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.

  • source
  • hideshow 9 child comments
  • [–] [S] 7 points 5 months ago (8 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.

  • source
  • parent
  • hideshow 8 child comments
  • [–] 4 points 4 months ago* (3 children)

    1023 for 10 disks, 5011 for 9 disks

    More moves for less disks?

  • source
  • parent
  • hideshow 3 child comments
  • [–] [S] 8 points 4 months ago (2 children)

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

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 4 months ago (3 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 ?

  • source
  • parent
  • hideshow 3 child comments
  • [–] 7 points 5 months ago

    Didn't know it had a name but that makes sense... I remember playing a minigame puzzle like that as a kid in KOTOR

  • source
  • 6 comments in c/linux@lemmy.ml view that post
    [–] 28 points 5 months ago (5 children)

    Impressive 🙂

    Unsolicited Rust rewrite in 5…4…3…🤭

  • source
  • hideshow 5 child comments
  • [–] 2 points 5 months ago (3 children)

    Why are you sharing your program with miniserve?

  • source
  • parent
  • hideshow 3 child comments
  • [–] [S] 1 point 5 months ago (1 child)

    I don't understand what you are asking, please elaborate.

  • source
  • parent
  • hideshow 1 child comment