# Thread: Trouble Generating Game Algorithm

1. ## Trouble Generating Game Algorithm

Okay, I've just about finished developing my game. It basically renders a screen with a two-dimensional array containing all the "blocks." The object of the game is for the player to click a "set" of blocks, (where a set is two or more blocks of the same color that are connected, or touching each other) trying to eliminate all of the blocks on the field. It works great if thats all your interested in, but now I'm trying to develop an algorithm that would solve the field in place of the player. I dont have much experience in writing algorithms or anything beyond basic AI, but this seems more of an algorithm solution. Does anyone have any suggestions as to the best approach to solving this?

2. oops. Forgot to mention that once you clear a set of blocks, the blocks on top of those drop down... so if there was a set of blocks (blocks[3][2] & blocks[3][3]) when you cleared this set, blocks[3][1] would drop to blocks[3][3]..

3. This sounds like Tetris.

4. You could just represent the game state through time as a tree, with the split at each node as all the possible moves, then you could brute force that, or I suppose you could use something like A* or a GA to search it too.