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!
@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.
wouldn't the optimal be building a thin tower leaving like 6 rows on the top? that way the pieces don't have to fall as far and you can do it faster without speeding the game up.
Beats in what sense? If you mean raw score then yes there are Tetris algorithms that can make 100's of MILLIONS of lines - surely far more than any human could make. Though of course as the speed increases humans find it hard to place the pieces accurately - which becomes the limiting factor. Computers don't suffer this problem of course.
If you are talking multiplayer Tetris then I guess people still have the edge. None of the algorithms so far are very aggressive, they play slow and steady.
Well the thing is that the algorithm might not be as smart as playing but still win out as Tetris is more of an endurance and reflexes game at the higher levels. So the algorithms will always have the edge.
As for RTS games - I don't think we will see a RTS bot that can match pro level humans for quite some time. Current RTS algorithms rely on lots of 'build scripts' and do very little high level planning (in the AI sense). I can't see this changing soon as such an AI won't be fun to play!
Looks like the program looks for the correct 'terrain' on the surface of the blocks to find the correct position for the next block. That's why there was a huge stack at 1:06. That's usually how I play the game anyway.
It would be really cool if someone made a program for an RTS game that would play an almost perfect game. Something to do, I guess, when I get more into programming.
RTS AI is far, far more complex than AI for pretty much any other game. Mathematically, there aren't any algorithms that can iterate through every possibility (much like in chess or Go); there are just too many possibilities. We can't even come up with perfect algorithms for some simple scheduling problems. This is the reason that approximation algorithms are so prevalent.
Possibilities in RTS games are like chess to the power of 20.
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.
yes but some tetris programs set the order of pieces 10 pieces in advance so there isn't slowdown. if the AI took advantage of knowing the queue order, it would be way more successful
So how was this done exactly, or in less than 500 words :) I'm writing a neuroevolving strategy for a checkers game in python as well. I have to say though that i'm rewriting most of it in c now, because all the bottlenecks where simply due to the inefficiencies of python. Now that I see that you got really great results also using an evolution strategy, its making me reconsider that decision ...
i thought it was funny too :) but I do believe it to be the optimal thing to do in that case, to just stack them up out of the way. So i was happy that the AI thought so as well
Yet i always thought that neural networks learn from more likely situations and being offered the same block over and over again is exceptional in tetris. So maybe it's not the best way, or maybe it should stop stacking at an ideal moment? Just makes me think lol.
Why does it put all the 2*2 blocks on top of eachother? (I don't think this is a bad tactic, but aren't there situations in which it can be placed somewhere better (assuming I didn't miss it due to the speed of this video))
you should try posting some python tutorials - id be interested to learn it, they should have something like this at the end showing an example of something that can be achieved with it :)
Hey Badmephisto, I was wondering if you would lend me some advice.. Ive been wanting to get into programing for some time now and I dont know where to start or how to start? Ive searched the web but haven't had any good luck. Maybe you can help me? I would appreciate it..
you work recursively. The idea is, that you generate a descend policy by guessing the weights, then you use that policy and play 2000-3000 games. You use those games as your sampling data, to generate a new policy, and so forth. Try googling "tetris constraint sampling"
it sounds like the approach i'm taking here. guess good weights, but then i have a genetic algorithm that does the seeking. When it comes down to it, aren't they equivalent? What do you think would be the pro's of using the NN approach?
well, if you are using a set of basis functions and weights, to evaluate your actions, then you are practically dong neuro dynamic programming. The difference is how you derive the weights. I did the constraint sampling approach, which gave me a policy that does 7000 on average, but there is also the Cross Entropy method, that can give results of 100 000 lines on average (assuming you are willing to train it for a month).
holy shit i didnt understand a word of tht...will one of you guys make a python tutorial but not too basic...make it like "how to make a simple game" and find links to a good functions database pleeeeease i love u
What would be the point? There's nearly no logic in a FPS. Things like this consist of 2 things: Logic and probability. But the 2nd is actually a part of the first, to be exact...
Is there any chance you will upload this for download? I'd like to have a glance at it, maybe get it to almost invincible (I have a mad machine here ;))
Well I find C++ and Python a little more complex then scripting. Now I have done some crazy things with actionscript (made a full RPG actually that was some huge file) but I think those are more easily understood and learned.
Does this 'simply' work out the best place for each piece when it 'appears' or plan for future pieces as well? Also, what does it learn from a single move?
it does plan ahead for the next piece. It doesnt learn anything from a single move. It learns something from how many lines it made before it died. Then it adjusts its strategy and tries to play differently, and sees how that goes.
How does a AI "evolve". I am just getting into programming and I think that is brilliant! Thnx for the cubing vids too...My averages would be at a minute still with the LBL...now they are nearing sub 20
is it possible to see the source code? I'm new at AI and would really like a little peek inside this
baekalfen 2 weeks ago
This is still cool after a year of discovering this vid lmao
Cubalisk 2 months ago
Awesome!
cwbh10 6 months ago
ICH VILLE
epicninja5 8 months ago
awesom song
BereanBaptistAcademy 8 months ago
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!
simpleprimate 9 months ago
Is this speed up or in real-time?
PeopleR2sensitive 1 year ago
@PeopleR2sensitive its fo' real
badmephisto 1 year ago
Wish I could play like that. Coach was right, it's not my circumstances, I just suck ;-;
JSona100 1 year ago
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.
TheReasonWhyGuy 1 year ago
@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.
badmephisto 1 year ago
cool !!!!!!!!!!!!!
ThePokemaster8 1 year ago
wow... this thing plays tetris better than i can o.o
ERTLPFM 1 year ago
wouldn't the optimal be building a thin tower leaving like 6 rows on the top? that way the pieces don't have to fall as far and you can do it faster without speeding the game up.
timonix2 1 year ago
well, it's much better then i am!
Strikesnake1994 1 year ago
The joy of giving life to a computer with a Rubik's Cube in one hand... yay!
Cubalisk 1 year ago
Great. Face this against bastard tetris (a tetris make which calculates the worst piece you can get on your next move). See who the victor is.
outragious 2 years ago 16
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.
obesechicken13 2 years ago
Beats in what sense? If you mean raw score then yes there are Tetris algorithms that can make 100's of MILLIONS of lines - surely far more than any human could make. Though of course as the speed increases humans find it hard to place the pieces accurately - which becomes the limiting factor. Computers don't suffer this problem of course.
If you are talking multiplayer Tetris then I guess people still have the edge. None of the algorithms so far are very aggressive, they play slow and steady.
Ikaath 2 years ago 2
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.
obesechicken13 2 years ago
Well the thing is that the algorithm might not be as smart as playing but still win out as Tetris is more of an endurance and reflexes game at the higher levels. So the algorithms will always have the edge.
As for RTS games - I don't think we will see a RTS bot that can match pro level humans for quite some time. Current RTS algorithms rely on lots of 'build scripts' and do very little high level planning (in the AI sense). I can't see this changing soon as such an AI won't be fun to play!
Ikaath 2 years ago
Cool!
Looks like the program looks for the correct 'terrain' on the surface of the blocks to find the correct position for the next block. That's why there was a huge stack at 1:06. That's usually how I play the game anyway.
It would be really cool if someone made a program for an RTS game that would play an almost perfect game. Something to do, I guess, when I get more into programming.
5/5
YoinkinatorX 2 years ago 3
RTS AI is far, far more complex than AI for pretty much any other game. Mathematically, there aren't any algorithms that can iterate through every possibility (much like in chess or Go); there are just too many possibilities. We can't even come up with perfect algorithms for some simple scheduling problems. This is the reason that approximation algorithms are so prevalent.
Possibilities in RTS games are like chess to the power of 20.
evilmeatmeat 2 years ago
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.
YoinkinatorX 2 years ago
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.
evilmeatmeat 2 years ago
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.
obesechicken13 2 years ago
AI is an awesome area for computing. I wish I can go AI when I finish my bachelor.
Gretgor666 2 years ago
does it have look ahead (does it know the pieces in advance) or does it just go on the fly?
i noticed situations where it could have gotten 4 rows if the look ahead was better
vgbjason 2 years ago
im pretty sure the pieces were set to a random veriable
catstuffer 2 years ago
yes but some tetris programs set the order of pieces 10 pieces in advance so there isn't slowdown. if the AI took advantage of knowing the queue order, it would be way more successful
vgbjason 2 years ago
really nice
wennesnichtsowaere 2 years ago
does it learn a it goes.
hi52utoday 2 years ago
Woah, that's asking a lot!
Just program in evolution.
It isn't impossible (as various videos will show you) but I would imagine that it wouldn't be the worlds easiest programming feat.
ItsConcept3D 2 years ago
Dude, watch the Terminator.
XmetaI4everX 2 years ago
how can i put this on my computer?
car1294 2 years ago
i like the techno tetris music
Sharkbait173 2 years ago
thats awsom wot AI did u use??
allinighdrui 2 years ago
one he made
randomnessguy25 2 years ago
haha yeh i ment wot method like neural net, swarw etc
allinighdrui 2 years ago
he programmed the AI, that's the whole point of the video
vgbjason 2 years ago 2
yeh mate i get that, i study AI as part of my course at uni and i woz wondering wot category of AI it is (like any programming theres loads)
allinighdrui 2 years ago
oh, sorry, : P
vgbjason 2 years ago
haha np man :)
allinighdrui 2 years ago
Cool program , I love that song too.
Zastend 2 years ago
So how was this done exactly, or in less than 500 words :) I'm writing a neuroevolving strategy for a checkers game in python as well. I have to say though that i'm rewriting most of it in c now, because all the bottlenecks where simply due to the inefficiencies of python. Now that I see that you got really great results also using an evolution strategy, its making me reconsider that decision ...
timesthebear 2 years ago
i'm faster than this ai lol
but thats on a version where you can do spins and slides etc
thefloppyking 2 years ago
Very nice work on the AI tetris... I hope you make more programming videos and Rubik's Cube vids too...
PCGBsc 2 years ago
LOL at the 2x2s on the left side around 1:06
RogerFlint 2 years ago
lol that made me laugh too
MrHankkey93 2 years ago
i thought it was funny too :) but I do believe it to be the optimal thing to do in that case, to just stack them up out of the way. So i was happy that the AI thought so as well
badmephisto 2 years ago
Yet i always thought that neural networks learn from more likely situations and being offered the same block over and over again is exceptional in tetris. So maybe it's not the best way, or maybe it should stop stacking at an ideal moment? Just makes me think lol.
Droyd21 2 years ago
It was pretty cool XD
RisenOrder1224 2 years ago
that AI beasting it up
cmon200 2 years ago
COOL TRACK
Tortak39 2 years ago 8
Nice... That AI is better than I am at Tetris...
It also has better look-ahead than I don on my cube X3
ThieflordZ5 2 years ago 3
that's BECAUSE it's an AI; a good AI will always beat human opponents
Asolmanx 2 years ago
ai will beat human? in the immediate but non for long, we're both self learning machines
culturaelarghezza 2 years ago
awesome remix music!
ben1996123 2 years ago 3
Why does it put all the 2*2 blocks on top of eachother? (I don't think this is a bad tactic, but aren't there situations in which it can be placed somewhere better (assuming I didn't miss it due to the speed of this video))
5THunderlord 2 years ago
you should try posting some python tutorials - id be interested to learn it, they should have something like this at the end showing an example of something that can be achieved with it :)
ChaosAerodemon 2 years ago
omg i agree this guy turned me into a python addict exept i cant do crap with it!!!!
buggyiscool 2 years ago
Hey Badmephisto, I was wondering if you would lend me some advice.. Ive been wanting to get into programing for some time now and I dont know where to start or how to start? Ive searched the web but haven't had any good luck. Maybe you can help me? I would appreciate it..
Thnx 4 your time
jofimar13 2 years ago
Try doing it using neural networks. I have a working example that does 7000 lines on average, and can reach up to 45 000.
michaeljx 2 years ago
I don't understand -- what do you use as training data?
badmephisto 2 years ago
you work recursively. The idea is, that you generate a descend policy by guessing the weights, then you use that policy and play 2000-3000 games. You use those games as your sampling data, to generate a new policy, and so forth. Try googling "tetris constraint sampling"
michaeljx 2 years ago 2
it sounds like the approach i'm taking here. guess good weights, but then i have a genetic algorithm that does the seeking. When it comes down to it, aren't they equivalent? What do you think would be the pro's of using the NN approach?
badmephisto 2 years ago
well, if you are using a set of basis functions and weights, to evaluate your actions, then you are practically dong neuro dynamic programming. The difference is how you derive the weights. I did the constraint sampling approach, which gave me a policy that does 7000 on average, but there is also the Cross Entropy method, that can give results of 100 000 lines on average (assuming you are willing to train it for a month).
michaeljx 2 years ago
holy shit i didnt understand a word of tht...will one of you guys make a python tutorial but not too basic...make it like "how to make a simple game" and find links to a good functions database pleeeeease i love u
buggyiscool 2 years ago
I need an AI for a First Person shooter, anyone mind giving me tips on how to start? The FPS is Return to Castle Wolfenstien.
Dudemiester666 2 years ago
you don't understand this.
dfpcmaia 2 years ago
What would be the point? There's nearly no logic in a FPS. Things like this consist of 2 things: Logic and probability. But the 2nd is actually a part of the first, to be exact...
5THunderlord 2 years ago
And FPS " IAs " already exists... they are called bots ^^
RalenSanis 2 years ago
"Unfortunately I don't possess enough computing resources to have it learn more and fine tune the parameters as much as I'd like"
Start a distributed network of Tetris AIs!
cyborgtroy 2 years ago
very cool!
caphits 2 years ago
Is there any chance you will upload this for download? I'd like to have a glance at it, maybe get it to almost invincible (I have a mad machine here ;))
RoboSquc 3 years ago
machene spec wont affect AI preformance as the effect of a crap machene on the game and the ai are preportional
alecTHElion 3 years ago
Well, the description says he doesnt have enough computing power, and I think I do, so thats why I asked
RoboSquc 2 years ago
computing resoruces, not preformance. he means time to do it in, a faster computer will not affect the intelligence, of an AI system
alecTHElion 2 years ago
aaaah, k, although I would still like to have it ^^
RoboSquc 2 years ago
well fair enough me too :)
alecTHElion 2 years ago
Yeah, it's sort of a Turing thing. You'll always evolve a better AI, but a faster computer could evolve it sooner.
cyborgtroy 2 years ago
Sweet!
Artificial Intelligence is awesome!
Buggy793 3 years ago
I wish you somehow get all the computing resources to improve this up to invincible.
xsdnide 3 years ago
how did you make it?
ben1996123 3 years ago
great work, i tried getting into python but seem to just do better with noob scripting languages like actionscript 1/2/3 JS and such.
Good music choices by the way, I would love to see you "techno" playlist.
WeiseGuy91 3 years ago
How come AS3/2/1 are noob scripting languages? I havent found myself doing flash code in C++.
MikoNukka 3 years ago
Well I find C++ and Python a little more complex then scripting. Now I have done some crazy things with actionscript (made a full RPG actually that was some huge file) but I think those are more easily understood and learned.
WeiseGuy91 3 years ago
Hey wahts this song? what other techno do you have badMephisto? Your speedcubing is awesome BTW.
optikon2222 3 years ago
You didnt read the description did you..?
lighteelco 3 years ago 2
WHAT THE FU
dge?
I never got subscriber notification of your previous 2 videos (this and PLLs Rec.)
Eh, well, get ready to see a viewer count increase, and probably more of my obsessive comments.
ThisIsWEB 3 years ago 2
yay
badmephisto 3 years ago
Very cool :-)
Mozza314 3 years ago
It was @omfgmouse
meaintsmart 3 years ago
soooo cool
patrick1020000 3 years ago
Why don't you make it always go for 4 lines at once?
omfgmouse 3 years ago
because thats not a good strategy if you want to survive longest
badmephisto 3 years ago
A "Tetris"?
meaintsmart 3 years ago
Can't wait to see it go really fast :D
boiswatching 3 years ago
it goes really really fast... i just made it go slow so that you can see whats happening.
badmephisto 3 years ago
Does this 'simply' work out the best place for each piece when it 'appears' or plan for future pieces as well? Also, what does it learn from a single move?
ninjakannon 3 years ago
it does plan ahead for the next piece. It doesnt learn anything from a single move. It learns something from how many lines it made before it died. Then it adjusts its strategy and tries to play differently, and sees how that goes.
badmephisto 3 years ago
How does a AI "evolve". I am just getting into programming and I think that is brilliant! Thnx for the cubing vids too...My averages would be at a minute still with the LBL...now they are nearing sub 20
birdman3631 3 years ago
that no ai it just a program!
TheAlchemist1023 3 years ago
Impressive
petercourt 3 years ago
I enjoy watching this as much your cubing video's. It's always nice to see AI capable of beating the human mind at something. Nicely done!
Pr3miuM 3 years ago
Ohh...what is this song called? It is very familiar, but I can´t remember the name. Please someone: Tell me!
joeman1986 3 years ago
Tetris by...
Either Zam, 2am, 2pm, or something of the like (three letters long, but i've only glanced at the author so it is wrong on my iPod.)
Paroxymic 3 years ago
@joeman1986
korobeiniki
btkw 3 years ago
pretty awsome...on tetris for teh DS i got 803 lines once...
BillyBobsEel 3 years ago
I always stacked up and hoped for a 4piece bar so I could get a lot of points, worked pretty good.
Singul4r1ty 3 years ago
how did it eventually end?
chrysophylaxdives 3 years ago
I love the song!
ABQMagni5 3 years ago
Impressive indeed.
Dylanarp123 3 years ago
Very impressive.
riffz 3 years ago
Are these Tetrix Mixes actually downloadable songs? and if they are where can i find them?
pandappotamus 3 years ago
yea they are , you could probably find them on limewire easily ^-^
TheRetributioner 3 years ago
Nice bot o.o
The actual pro players are pretty close to that speed though damn lol.
They just can't move the pieces to the right and left as fast.
BIueSky 3 years ago
Good solve!
terrapin52 3 years ago
It probably didn't take him long...
Quick question: How exactly did you write this in Python? You must've had something like Pygame as the interpreter to do this.
123IOWNALL321 3 years ago
So you basically made a bot?
Halocuber 3 years ago
wow!
thats awesome!
how long did it take you do write?
theWestonian 3 years ago
Cool vid!
liljessboboy 3 years ago