Sign in to follow this  

AI For Puzzle Games

This topic is 4718 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm new to the AI forums, and haven't posted here once. I have taken a course in data structures, and I covered a little searching and I understand A*, if you consider that AI. I'm making a puzzle game, and my AI has been pretty sad so far. Basically, the game play is a lot like tetris, except instead of making rows, the goal is to make different shapes out of triangle-shaped pieces. Basically you have a triangle like:
  //\\ 
 //  \\  
//____\\


and the goal is to make different pieces out of the triangles like squares, pyramids, (more shapes to come), so it the pieces would look like:
______
\    /|
|\  / |
| \/  |
| /\  |
|/  \ |
/____\|
(a square)

      //\\
     //  \\
    //____\\
   //\\    //\\
  //  \\  //  \\
 //____\\//____\\
(a pyramid)






Player play on a regular tetris-like area, but there is also a computer player who will challenge you. The only thing I've been able to come up with is hard-coding the AI, and it worked out pretty good for a square. But I think that hard-coding it is really a bad idea, especially because it will need to be re-implemented for every new shape. Does anyone have any idea as to what sort of AI I should be looking into in order to solve this problem? Any help would be greatly appreciated. [EDIT: Fixed the ASCII ART]

Share this post


Link to post
Share on other sites
Ok, my take of the game:

You get a triangle, you then transpose it (like shove it upside down), and put it in a spot on the grid.

There is a time limit on that.

heres my take on your solution.

You find out, each possible piece which you can drop. (for eg. an upside down triangle on the 6th square), and you find a value for it.

That value, is the utility, for eg. if you make a shape, it has a heigher utility, then one that doesn't. (you'll ahve to make one, for each possible shape).

Also, if you stop a possible shape, then you give it a lower priority, then one that didn't stop the shape.

Simple maximum, and you've got yourself a goodish bot, for the entirity of 30seconds it took to come up with the design.and the minute it takes to implement it.

From,
Nice coder

Share this post


Link to post
Share on other sites
Quote:
Original post by Nice Coder
Ok, my take of the game:

You get a triangle, you then transpose it (like shove it upside down), and put it in a spot on the grid.

There is a time limit on that.

heres my take on your solution.

You find out, each possible piece which you can drop. (for eg. an upside down triangle on the 6th square), and you find a value for it.

That value, is the utility, for eg. if you make a shape, it has a heigher utility, then one that doesn't. (you'll ahve to make one, for each possible shape).

Also, if you stop a possible shape, then you give it a lower priority, then one that didn't stop the shape.

Simple maximum, and you've got yourself a goodish bot, for the entirity of 30seconds it took to come up with the design.and the minute it takes to implement it.

From,
Nice coder

Thanks for the reply. I was thinking I'd need to do something like looking at all of the different possible outcomes and assigning a value to each one, then placing the triangle in the position that has the greatest value. I just wanted someone else's opinion on the matter to see if there was a better way to do it.

Share this post


Link to post
Share on other sites
You could use A*, just make up a version, which generates the greatest path cost. (ie. nodes have a + weighting, and moving from one to another has a - weighting.).

You then just search for the best path in the time you have (No definite goal, just keep searching).

Then you place it where it needs to go.

With a good enough heuristic, it could search massivelly ahead, and still return moderatly fast. (not in the nanosecond range, just less then a second, The longer you give it, the better the path will be.).

From,
Nice coder

Share this post


Link to post
Share on other sites

This topic is 4718 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this