Results 1 to 3 of 3

Thread: For fun's sake

  1. #1
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile For fun's sake

    Here comes my first game in Qt : Hanoi Tower

    It needs Qt 4.2 because QGraphicsView is used for rendering. First of all if you can't bear frustration and don't like playing with logic just forget about it or it might cause serious brain damage (and might even affect your computer )

    Graphically speaking this app sucks a lot and any help would be welcome to improve this aspect. ATM user only automated resolution and user moves are supported (through D'n'D with proper checks to prevent invalid moves) and resolution is detected only when all disks are moved to the last peg but I plan to had more features to bring some more fun...

    Get the sources and feed me back.

    Hoping you'll like it.
    Current Qt projects : QCodeEdit, RotiDeCode

  2. The following user says thank you to fullmetalcoder for this useful post:

    No-Nonsense (8th March 2007)

  3. #2
    Join Date
    Oct 2006
    Posts
    60
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: For fun's sake

    Well I got the program and it compiled but what is the purpose/rules of the game? Also the "Solve" feature seemed to error out as it was going along and then a message popped up about not putting a circle in the right place. Then it just sat there, unless of course the puzzle was solved but I couldn't tell.

    mAx

  4. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: For fun's sake

    Quote Originally Posted by maxpower View Post
    Well I got the program and it compiled but what is the purpose/rules of the game? Also the "Solve" feature seemed to error out as it was going along and then a message popped up about not putting a circle in the right place. Then it just sat there, unless of course the puzzle was solved but I couldn't tell.

    mAx
    Searching on the net will bring you the answer you need but I'd rather explain th rules here because any search will also lead you to the optimal solution algorithm (used in the solve function which shouldn't be able to cause error by the way, unless you already started to move disks around).

    The rules are very simple :
    • n disks are on the first peg, biggest at the bottom and the goal is to move them to the last peg using the smallest possible number of moves
    • you can only move one disk at a time and only the one on top of each pegs
    • to move a disk to another peg it must be smaller than any other disk that may be present on the target peg already.
    FYI it has been proved that the optimal solution is 2^n - 1 moves. So the "default" game (if you don't use the spinbox to change the number of disks) is 15 moves. Good luck.
    Current Qt projects : QCodeEdit, RotiDeCode

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.