Thanks for checking it out.
RogerBidon wrote:
I wonder what would happen if the AI only evaluated the current hats pair for placement consideration, without care to the next-pair. Would it be largely detrimental to the number of spawns before gameover or not? From pure feeling, it seems that what is immediatly good is also good in the long run, the evaluation function already takes care of strategy by aiming at homogemeous piles.
Committing to a placement too early using only what is immediately good ignores the best overall solution. The quantitative different is actually quite considerable: an entire order of magnitude. This is the primary why most sequential puzzle games expose one or more next pieces to the player. From my own experience of playing Tetris for too many years, I've learned to always think in terms of pairs, not just the currently falling piece. Still, it is always possible that some significant piece exists just beyond that horizon that would effect the current placement had the information been accessible. The evaluation function is only a default, general strategy; it's the best guess after taking into account all of the available information. It's good at dealing with average cases, but it can't compete with specific knowledge.
RogerBidon wrote:
Conversely, what would be the effect of searching farther than the next pair? It could be possible to verify all possibilities some turns in advance, but it is exponantial. Maybe some smart guessing of what would be the worst pair to handle may allow to handle just that for some turns after the "current next-pair". Simply simulating the deterministic PRNG can also predict series of pairs perfectly, but can be argued as cheating.
In the case of Hatris, check out the description of the PRNG in the article. By measuring the number of frames in between spawns, it's actually tied to the behavior of the player. There is no way to programmatically generate more of the sequence.
Of course, the plug-in could always just replace the PRNG with one of it's own, providing it with full knowledge of the entire sequence. Every next pair that it took into account would improve the placement of the current pair, albeit with diminishing return (the distant future has only a minuscule effect on the present). It should also be noted that while some sequences would enable the game to go on indefinitely, the vast majority of sequences lead to Game Over regardless of placements chosen; however, if the full sequence were known, then in principle, it is possible to search for the optimal placements that would push Game Over out as far as it could possibly go.
The evaluation function's job is to essentially ask if the playfield can readily accommodate whatever is to come next regardless of whatever that may be. It could actually try all 36 possible hat pairs to find out. Or, it could evaluate a sampling of short randomly generated sequences to see the outcomes and average them together. But, as mentioned above, whatever it does, it is really only providing an average answer. It's the best guest when there is nothing else to go on.