Blocky Puzzle Game Algorithms

Started by
11 comments, last by capn_midnight 21 years, 10 months ago
Try removing all N blocks in your recursive function and then using another loop to drop blocks into the gaps keeping each process seperate.

(1) Get rid of all blocks replacing with a Gap symbol (modified existing recursive function).

(2a) From bottom to top-1, left to right replace any Gap symbol with the block above, set that block to a Gap symbol.

(2b) Replace Gap symbols on the top row with whatever method of generating new tiles you are using.


,Jay
Advertisement
Jay''s way is exactly how I would do it too. I find a lot of programming is simplified if you can do it in several short and simple passes rather than in one deep and complex pass.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files ]
Capn, if you''re using VB, make sure you aren''t passing params by value rathern than by ref. If you are relying on the sub to change the value of the block so that future views of the block see that it''s already been "popped," then passing by value will definitely result in an infinite recursion.

This topic is closed to new replies.

Advertisement