Thread: Trouble Generating Game Algorithm

  1. #1
    Registered User
    Join Date
    Jun 2007

    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. #2
    Registered User
    Join Date
    Jun 2007
    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. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    This sounds like Tetris.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    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.
    Illusion and reality become impartiality and confidence.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Doxygen failing
    By Elysia in forum A Brief History of
    Replies: 19
    Last Post: 04-16-2008, 01:24 PM
  2. C Programming 2d Array Question
    By jeev2005 in forum C Programming
    Replies: 3
    Last Post: 04-26-2006, 03:18 PM
  3. craps game & dice game..
    By cgurl05 in forum C Programming
    Replies: 3
    Last Post: 03-25-2006, 07:58 PM
  4. Try my game
    By LuckY in forum A Brief History of
    Replies: 14
    Last Post: 09-15-2004, 11:58 AM
  5. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM