Videos

Tetris Artificial Intelligence (AI) #2



badmephisto

This is my second attempt in producing AI for Tetris.

Grid size is 10×20
I made this in Python
It almost always does more than 1000 lines, and most I’ve seen it do was about 5000. Unfortunately I don’t possess enough computing resources to have it learn more and fine tune the parameters as much as I’d like, but this will do for now! πŸ™‚

music: Tetris by 2am

Source

Similar Posts

26 thoughts on “Tetris Artificial Intelligence (AI) #2
  1. True, it would be extremely difficult, but it is definitely possible. They already have AI for some RTS games, but they tend to be inefficient.

    My goal would be to make the AI incredibly efficient with resources and units and scout out enemy weaknesses to make the most of the units at hand.

  2. There are a bunch of really hard problems that need to be overcome. How do you decide what units/buildings the AI will build? Take a game like Supreme Commander: there are so many possibilities that it's hard to imagine a computer succeeding without having a general "strategy".

    Indeed, I think the best way to go about AI for RTS games is to have the AI analyze the situation and develop a rough 'plan'. You then work towards efficiency of resources and unit orders (etc. etc.). Just an idea.

  3. I think the Starcraft 2 AI is supposed to counter by scouting. There are some rather 'intelligent' starcraft 1 AI's made by fans already.
    But right now ~ no AI can beat a human fairly in an rts like Starcraft or SupCom without the use of reaction speed abuse.

  4. Has a tetris AI been invented that works perfectly or beats humans? On youtube some people do just as well as this AI.

    The tetris wiki says not much has been done for a tetris AI. I'm talking about if the computer doesn't cheat by looking at the seed in advance.

  5. Yes, I meant by raw score πŸ™
    Pretty soon they'll start beating us in RTS's fairly…
    I just wasn't sure if a computer could beat a human because its algorithm wasn't smart enough. Speed was never the issue.

  6. does this operate off of a simple possible placement evaluation scale?
    Where placements are weighed, and then the highest value place is chosen.
    The weight would likely be based on height, and snugness.

  7. @TheReasonWhyGuy yep, from experience I came up with a bunch of metrics for whats good and whats bad about placing anything at any spot. The "learning" here is just finding what weights give best performance. It's not nuclear science indeed πŸ™‚ still works pretty well, but I'm sure it's possible to do much better.

  8. Random awesomeness of the day!! I would love to take a look at source code for this if you would like to share. I found a Tetris AI written in Pascal on sourceforge, but I'm more familiar with python so i would love to learn from this if possible. thanks for distracting me from the tedium at work!

  9. @badmephisto No, the optimum placement for the 5 2x2s around 1:06 was 1st and 2nd piece into the 1×4 gap (columns 6-9) in the 2nd row, 3rd piece into the then existing 1×2 gap (columns 4-5) in the 3rd row, 4th and 5th piece again columns 6-9, row 4. It is absolutely crucial to keep things level. Stacking (while having positions for gapless placement) brutally decreases the flexibility of what you can do with future pieces. A PROPER Tetris AI is EXTREMELY, almost impossibly, difficult to create.

  10. @badmephisto The problem of Tetris is that the speed should gradually increase indefinitely, putting too much pressure on ANY AI (AI optimization just a matter of delaying the ultimate loss, not preventing it). But even with constant low speed, there is a situation, sooner or later, due to the "completely random" (in an ideal world) selection of pieces, that even the best possible AI (considering all available information) cannot solve. From this standpoint, I don't like Tetris. πŸ™‚

  11. @badmephisto It is e.g. like Minesweeper – there are OFTEN situations that are completely impossible to solve (with certainty, not just high probability). And the game LOOKS simple as well.

  12. I don't understand videos like this. Without any narration, I have no way of knowing what is supposed to be happening. Teaching a computer to play Tetris shouldn't take much in the way of artificial intelligence, however. It mainly just requires total attention, persistence and lightning fast reflexes, all things computers excel at.

Comments are closed.

WP2Social Auto Publish Powered By : XYZScripts.com