Solving the Towers of Hanoi using Stack in Java (Java Foundations / jsjf)

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024

Комментарии • 2

  • @mattacarregui3934
    @mattacarregui3934 5 дней назад

    This is awesome! I am curious though: could you use this structure in a 1 player version of the game, ensuring moves are valid by peeking at the top values of the tower you are trying to move to? If so, how could you develop a “hint” feature that would guide you in the correct direction without making a graph of all the nodes and running a search algorithm? Is there a numerical indicator of the “correct direction”? Lmk what you think!!

    • @mattacarregui3934
      @mattacarregui3934 5 дней назад

      Side thought: it seems the correct direction along the graph could be determined by ensuring no two odd or even numbers are touching on any of the stacks and if a relatively big ring is on the correct peg. But how would you determine the next best move?