Re: Challenge: Algorithm To Generate Bubble Blast 2 Puzzles With Difficulty
by QM (Parson) on Aug 30, 2013 at 09:50 UTC
|
Does it make sense to do this in reverse? That is, generate boards at random, then "play" the boards. Board play is along 2 lines -- mean number of random touches to clear, and minimum number of touches in best play.
Easy boards will have less variation between random and best play, compared to hard boards. As the board difficulty rises, then given number of touches gets closer to best play. (It's up to you whether you use the "infallible" level, where allowed touches == best play.)
Thanks for the diversion today!
-QM
--
Quantum Mechanics: The dreams stuff is made of
| [reply] |
|
QM,
So, here is the problem:
It takes too long to figure out all the ways to play a game. I am thinking I need to lower the number of possible moves and limit how much time can be spent playing a single game. What do you think?
Update: I can complete approximately 40,000 games every 5 seconds. What I have done is impose a 6 hit limit along with randomly shuffling the return of possible_hits() and limited each board to 40,0000 games. I have manually tested this against a handful of boards and it appears to give a pretty good approximation of the results if all of them had been played. I would prefer a C based version of this which could likely do far more per second but my C is rusty (was never very good) and I can't remember how to manage a dynamic array.
Update 2: I turned the problem upside down and it became much easier. Instead of scoring how difficult the game was, I instead scored how easy the game was. I used a combined score of things like win to loss ratio, number of initial 1-hit moves to 1-hit wins, etc. The ones with the lowest score were the most difficult. Now I just need to code the actual game.
| [reply] [d/l] |
|
All,
I have ported the code to C (figured out how to avoid a dynamically managed array) and am making it available here for your critique/suggestions. I have never been a C programmer so there are probably a number of ways to write this more elegantly and efficiently.
Even in my neophyte C, I have realized an enormous performance increase. Even in C, it still takes too long to exhaustively play all possible games for a board when you allow the player to use up to 9 hits. For this reason, I duplicated the same changes I did to the original Perl (play a limited number of distinct but random games). The difference is that I am now able to use up to 9 hits and play 500K games in less time then it was taking me to play 6 hits for 40K games.
| [reply] [d/l] |
|
|
|
|
|
|
|
| [reply] |
|
| [reply] |
Re: Challenge: Algorithm To Generate Bubble Blast 2 Puzzles With Difficulty
by Yary (Pilgrim) on Aug 30, 2013 at 16:06 UTC
|
Think of the problem in reverse: start with an empty field- the "win" state- and play it backwards, with shrapnel coalescing into bubbles, sometimes leaving bubbles at the shrapnel source. By tweaking the rules-in-reverse, you can generate different levels of complexity.
I haven't thought it through in your particular case, just hope it gives you new ideas. | [reply] |
|
Yary,
I have thought of that and even generated a few boards this way. The problem is they only end up with the same outcome if game play starts the way your board generation ended. What I thought would be a "hard" board ended up being easy simply by picking a different starting position.
| [reply] |
Re: Challenge: Algorithm To Generate Bubble Blast 2 Puzzles With Difficulty
by choroba (Cardinal) on Sep 01, 2013 at 07:32 UTC
|
What happens if a bubble is hit from different directions at the same time? Imagine a situation like this: 1 2 1
2
1 1 1
The player clicks on the middle 1 at the bottom.
1 2 1
2
^
1 < 0 > 1
_
1 2 1
1
^ ^
0 > < 0
_0 > 2 < 0
v v
1
Does the 2 become 1 or 0?
Update:
Also, what happens in the following scenario?
1 < 0 > 1
v
3 1 1 3
_
< 0 > < 0 >
v v
3 1 1 3
_
3 < 0 > < 0 > 3
What happens next? Do the shrapnels explode when they meet each other in the middle?
| [reply] [d/l] [select] |
|
choroba,
In your first scenario, it becomes a 0 and explodes. Shrapnel doesn't explode when it meets each other so the 3s become 2s. You can actually play the game in "test drive mode" on Amazon here.
| [reply] |
|
v
>1<
^
but it is fun, anyway. I am still not sure how to generate "tough" initial setups, though.
A screencast.
| [reply] [d/l] [select] |