CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Auto generation of game puzzle data

  1. #1
    Join Date
    Jan 2016

    Auto generation of game puzzle data

    Hi, I'm developing a simple puzzle game, similar to the one shown in the picture.

    1 It consists of blocks on a grid.
    2.The blocks fall down to the grid if the block below it is removed.
    3. You can swap adjacent blocks (top or bottom)
    4. When 3 or more blocks are matched those blocks disappear.
    5. The object of the game is to have ZERO blocks left to win the level.
    6. It should be possible to complete the puzzle in 1,2,3,4, or 5 moves depending on the difficulty of the level.

    Each level takes an array of blocks as input.

    I want to auto generate the puzzle levels. I think this is possible but I have no idea where to start or how to go about it. Any help would be greatly appreciated

    Name:  Screen Shot 2016-01-09 at 15.21.38.jpg
Views: 116
Size:  34.1 KB

  2. #2
    Join Date
    Feb 2011
    United States

    Re: Auto generation of game puzzle data

    Well, the tricky part is ensuring that it is possible to complete the puzzle in a specific number of moves. Why not generate them by working backward?

    (1) Start with an empty grid
    (2) Add some number of same-colored blocks
    (3) Decide on a pair of grid locations to swap
    (4) Swap them
    (5) Optionally, adding a set of same-colored blocks (that would have been "destroyed" on the preceding swap)
    (6) Repeat steps 3-5 for X moves
    Best Regards,

    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #3
    Join Date
    Jan 2016

    Re: Auto generation of game puzzle data

    Thank you for taking the time to look at my thread. It sounds like a good solution. I will give it a go

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)