Question

I once wrote a Tetris AI that played Tetris quite well. The algorithm I used (described in this paper) is a two-step process.

In the first step, the programmer decides to track inputs that are "interesting" to the problem. In Tetris we might be interested in tracking how many gaps there are in a row because minimizing gaps could help place future pieces more easily. Another might be the average column height because it may be a bad idea to take risks if you're about to lose.

The second step is determining weights associated with each input. This is the part where I used a genetic algorithm. Any learning algorithm will do here, as long as the weights are adjusted over time based on the results. The idea is to let the computer decide how the input relates to the solution.

Using these inputs and their weights we can determine the value of taking any action. For example, if putting the straight line shape all the way in the right column will eliminate the gaps of 4 different rows, then this action could get a very high score if its weight is high. Likewise, laying it flat on top might actually cause gaps and so that action gets a low score.

I've always wondered if there's a way to apply a learning algorithm to the first step, where we find "interesting" potential inputs. It seems possible to write an algorithm where the computer first learns what inputs might be useful, then applies learning to weigh those inputs. Has anything been done like this before? Is it already being used in any AI applications?

Was it helpful?

Solution

In neural networks, you can select 'interesting' potential inputs by finding the ones that have the strongest correlation, positive or negative, with the classifications you're training for. I imagine you can do similarly in other contexts.

OTHER TIPS

I think I might approach the problem you're describing by feeding more primitive data to a learning algorithm. For instance, a tetris game state may be described by the list of occupied cells. A string of bits describing this information would be a suitable input to that stage of the learning algorithm. actually training on that is still challenging; how do you know whether those are useful results. I suppose you could roll the whole algorithm into a single blob, where the algorithm is fed with the successive states of play and the output would just be the block placements, with higher scoring algorithms selected for future generations.

Another choice might be to use a large corpus of plays from other sources; such as recorded plays from human players or a hand-crafted ai, and select the algorithms who's outputs bear a strong correlation to some interesting fact or another from the future play, such as the score earned over the next 10 moves.

Yes, there is a way.

If you choose M selected features there are 2^M subsets, so there is a lot to look at. I would to the following:

For each subset S
   run your code to optimize the weights W
   save S and the corresponding W

Then for each pair S-W, you can run G games for each pair and save the score L for each one. Now you have a table like this:

feature1    feature2    feature3    featureM   subset_code game_number    scoreL
1           0           1           1           S1         1              10500
1           0           1           1           S1         2              6230
...
0           1           1           0           S2         G + 1          30120
0           1           1           0           S2         G + 2          25900

Now you can run some component selection algorithm (PCA for example) and decide which features are worth to explain scoreL.

A tip: When running the code to optimize W, seed the random number generator, so that each different 'evolving brain' is tested against the same piece sequence.

I hope it helps in something!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top