This is a tough logic question

This is a discussion on This is a tough logic question within the C Programming forums, part of the General Programming Boards category; OK we all know about the towers of hanoi right. If not the towers of hanoi is were you have ...

  1. #1
    Unregistered
    Guest

    This is a tough logic question

    OK we all know about the towers of hanoi right. If not the towers of hanoi is were you have three pegs with n amount of blocks on each peg with different sizes. well the object of the game is to beable to move all the blocks on to a different peg and have them in the same order. The rules though are that you can only move one block at a time and can not move block that are greater in size on top of blocks that are less in size.

    We all know that this can be done pretty easily through the use of recursion.

    But have any of you ever given the thought of trying to do this problem without recursion???

    Do any of you know if it is truly possible??

    If so how??

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    34
    LOL. I have doubts that anyone will be able to answer that question. That is pretty tough without the use of recursion.

  3. #3
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Here's one solution (it's implemented in C++, if you can't convert it do a search on google and you'll probably find something).
    zen

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,852
    > Do any of you know if it is truly possible??
    Of course it is - recursion is just a disguised loop.

    True its likely to be a lot less consise than a recursive solution, but it would be possible.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. platform game logic, problem
    By Akkernight in forum Game Programming
    Replies: 7
    Last Post: 02-23-2009, 10:49 AM
  2. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 05:30 PM
  3. Design layer question
    By mdoland in forum C# Programming
    Replies: 0
    Last Post: 10-19-2007, 05:22 AM
  4. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM
  5. Tough question! How to read/write a file on a website!
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 12-12-2001, 09:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21