# So heres what i think would be really cool.

Thread in 'Strategy' started by BenMullen, 21 Nov 2013.

1. ### BenMullen

I wish there was an online trainer for tetris that you could choose the game you ant to get good at; NES, TGM, Cultis etc... then use algorithms specific to each of those that know (as best as can be known) the most optimal moves in a given circumstance, then with each peice you place it gives a numeric value for how optimal the move you made was from 0 to 1, 1 being the optimal move.

Obviously making the rules for what constitutes an optimal move for any given game is hard work, but i think a lot of work has already been done on this.

If it could happen it would be a powerful trainer for players of all skill levels. It could even give summaries after a game of how you did overall, an rating similar to a Chess ELO rating, and so on. It could be fun.

So, someone who knows what the heck thery are doing should do that, hahaha

3. ### cleure

Its definitely possible to make an algorithm that can detect which moves are possible. You can filter out a lot of "noise" by only looking parts of the stack are touching empty cells, and brute force every possible position you can fit the currently selected piece (there's a couple different methods that can be used here, it doesn't actually have to be brute force, but I don't think brute force would be terribly costly in this situation). The problem is that people take a lot of other information into account, as well. Things like next piece, stack height, and the "feel" of the randomizer all affect the decisions that real people make. Its hard to come up with well defined rules for a system, which can accurately account for something like that.

IMO, this is definitely a decision making problem, and really requires some sort of machine learning to be highly successful. Suppose that you program a bot to follow a specific set of rules, but then add on top of that PageRank, or some other algorithm which can be used for decision making based off statistics. Then you have this bot play Tetris for a really long time, building a giant database of which moves have the highest success rate in which specific situations (basically doing something like A/B testing for a very long time, until the best moves are found). There's a couple different ways to do that. You could either have pre-defined situations, and let the bot grind out those specific situations, or you can program a bot that plays naturally, like a person would.

I haven't had a chance to play try this idea out, but i have been working on some computer vision algorithms that can detect playfields, and find the playfield state by looking at an image (and convert that state to a searchable graph), with the intent to eventually write a bot that "learns" Tetris in real-time, by pointing a video camera to a TV screen and using a Teensy board to send input events to a NES (yeah i know, there are simpler ways, but it would be really freaking cool to have a bot learn NES Tetris on an actual NES).

Definitely ask Kitaru, as im pretty sure hes played around with making tetris bots before.

I know this isnt exactly what youre talking about, but it is somewhat related. Anyway, im writing this on my phone, so ill probably go back and correct some things once i have my computer in front of me.

Last edited: 24 Nov 2013
4. ### DonAtreides

One problem I can see a computer having is assuming that a player could always get the piece where they want it to go. A definite challenge on 19+.

5. ### BenMullen

I think that problem can be overcome with proper programming. All a computer needs do is know the highest ridge a piece can clear using only DAS charge (not hypertapping) then plan accordingly. In an even more ideal setting it might know from your inputs what your DAS charge is at any given instant and plan according to that.

This might actually be achievable, it might not, but I know alex is working on such a thing that might be able to sort of hijack all the inputs you make.... with a good AI on top of that, an AI made specifically for NES physics, we could get this to work.

or at least someone who can program could

6. ### BenMullen

So really, in assessing the "correctness" of each move the AI would need to distinguish between not only your incorrect placement decisions, but also your physical inaccuracies such as losing a bit of DAS charge.

Just from my own way of thinking about it I put inaccuracies into a number categories:

putting a piece in the wrong place (anywhere from totally crazy wrong, to very subtlety wrong)
putting it in the right place while using more button taps then needed (finesse)
anything that loses full DAS charge
maybe more idk.

7. ### cleure

You hit the nail on the head. This is partially what I was talking about when I said have pre-defined rules. The input system would need to be geared towards each specific version of Tetris you target, and also have the timings programmed into it (or learnable, if you want to get a more authentic simulation). You may also want to fudge the timings an inputs a little bit. I could see a bot being able to do things on 19+ with much greater accuracy than a human, which could make move suggestions a bit unrealistic. Things like input accuracy and complexity also need to be taken into account.