I programmed an A.I. to DESTROY the game PONG
2018 ж. 24 Қар.
2 936 649 Рет қаралды
I have a website: www.thebigcb.com
by the way don't expect the website to work on your phone, because it wont.
Check out Sentdex's tutorial: • Intro and Screen readi...
I also used the coding trains pong processing code: • Coding Challenge #67: ...
I think thats all the code i stole.
New videos every Saturday morning (probably)
Twitter: / code_bullet
Patreon: / codebullet
Discord: / discord
"I'm just gonna plagiarize that." The mark of a true programmer.
I mewn copy paste and deleting unneeded code, are the two best techniques...
YOINK!!!
This made me laugh way too much
What do stackoverflow programmers do when the stackoverflow server crashes?
99 percent of my code is like largely helped by my friend who goes to collage. xD Because educational system works. I'm too stupid to graduate highschool, but I've understood basic programming since I was like about 13. Yep, that makes perfect sense to me.
*CB copies some code from internet* - "That's how coding is done" Literally my whole developer career described
Don't you love open source
Nice
I would like to thank google and SO for my entire career.
Velociapcior i felt this comment inside my bones
import stackoverflow; so = new stackoverflow('python'); so.do("play pong");
Copy and paste code: “that’s how coding is done” Much truer than most realise.
Anthony Bailey it’s called copypasta (yes that’s the real name)
the ultimate truth
we are being paid to know what to copy and how to change it to fit our assignment
Copy, paste, adapt, overcome
Program an A.I that can code an A.I that can code an A.I that can play pong
Anti dead meme Organization machine learning is a thing.
So a genetic algorithm for genetic algorithms.
There's actually a technique that does that sort of thing called HyperNEAT
Skynet: :D
Anti Dead Meme **Horizon Zero Dawn intensifies**
Pong players HATE him for this simple trick
Senju Gold "simple trick" Nice.
Senju Gold is that a sketchy ad reference?
@@jeltehoekstra2952 it is a clckbait joke
found the Buzzfeed editor
Simple my ass
An AI that creates its own KZhead channel with regular uploads
What kind of videos are you thinking about?
0001 0111 Turn it into decimal and count it on alphabet A I
You mean five minute crafts
WEBDRIVER TORSO is one of them, I'm not joking, visit that channel, is creepy af
C'mon everyone knows that is an upload quality test bot.
Just discovered this channel So basically the concept is "I'm pretty shitty at games, but I'm pretty good at coding, so let's make AI that are good at games in my place", isn't it ?
Close. It's watch me TRY to make an AI and only occasionally succeed at making a good one
Wow! You're like Christopher Columbus, you discovered something a lot of people already knew about. Good job! We should name a holiday in your honor.
It’s more like “I’m pretty shit at coding, but I’m even more shit at games”
Yup
exactly, except it's "I'm pretty shitty at games, but I'm -pretty good- below decent at coding, but I can code, so let's make AI that are good at games in my place."
Pong players : playing 24/7 to be a god CB: makes an AI
@akusti boi yeah! It's always nice seeing a Terraria player in the wild :)
terrarriaaaaaaaa
1.4
CB: coding 24/7 to make an AI
This is by far the most accurate and realistic coding video I've ever seen.
The swearing, the way a "3 hour project" took days, the...adaptation of existing code from external sources. It speaks to our souls.
Programming nee new project Day 1) I'm glad to be on this assignment. Day 7) oh God, just delete this monstrosity. It hideous. It works for 30 seconds, and then the computer catches on fire. the next day) ah, glad that over. Oh look, a new coding project up for grabs. I try it out.
@@dancorps1388 nee?
@@dancorps1388 It hideous?
@@dancorps1388 that over?
>programs an ai to destroy pong >losing the game in thumbnail
Owo
Well you can't say its clickbait
Like number 666 i took a screenshot
You over here huh
@@carloromano3363 Which proves that he's losing, since the score is 9-4.
When you spend 20 seconds every video to pause it exactly when the subliminal message is displayed.
@Fredd Colour Green better tip use the ">" and "
*Stops time to see the text*
@@alphag4mer909 OMG! This has saved countless man-hours and truly changed my life...
@@alphag4mer909 isn't it just ',' and '.' since you're not holding shift
Next up: i programed an ai to topple the cambodian government
Implying they have a government to topple.
Thats easy. Just shift wage gap and class outrage from upper to middle class and destabilize the local economy. Use some chem trails to speed up the process.
@@Blasted2Oblivion The wage gap _and_ chemtrails on a single comment? What else, the earth is flat?
@@4.0.4 No. Just secretly ruled by Squirrels.
Im cambodian-
Next up: *I programmed an AI to print money*
I wish.
FBI OPEN UP!
@@bleeve9425 it's a joke
Bleeve 942 wooosh
You meant "I plagerized money printer AI"?
*AI learns to cyberbully*
We already had Tai.AI, and she was beautiful
beep boop fuck yourself beep boop
My kind of AI
You can buy those on Twitter
badtexts==[you suck,you are shit,fuck you,N00B, go eat crap] forever{ badtext#==ran(1-5) if (commentexist?==1){ reply ("item (badtext#) (badtext)") } }end
I feel like the title "Python Plays GTA V" is promising more than it can possibly deliver.
It was pretty good actually.
Oh it’s you, the guy who wanted them to refilm zero one so Izu didn’t die
@@lextatertotsfromhell7673 What the fuck are you talking about?
@@MuchWhittering your old pfp and name or something were the same as someone else, so I got you confused for them
@@MuchWhittering Fun fact: Pong was very popular in early days!!
Code Bullet's resumé - Special Skills: I can copy and paste code from the internet!
"Thaaaank yooou, taking thiiis" - the method of programming responsible for 90% of projects since the inception of the online search engine and Q&A style forum. ...those sped up parts of writing code are making me itch to build something. It's been years. Code is just.. beautiful. A concisely written, well formatted, well structured & cleanly executed sheet of code is nothing short of a work of art. Any tips on getting into Python without sitting through an article on Hello World with 20 paragraphs on the intricacies of printing text (I may or may not have attempted & promptly given up on learning one too many new languages, putting me through a few too many "back to basic" tutorials)
My advice is to grab IDLE from the python.org and start trying things out in the interpreter. Make something that solves a simple but real problem for you, or solves a simple and fake problem, or unsolves a problem. Just make something and learn from it. If you want a minimal guide I like this one: www.stavros.io/tutorials/python/
Aah programming. 10% inspiration, 90% *borrowing without permission*
JobsSharp Its funny because we're all mostly plagerists and reverse engineers. God bless open source.
Use Derek Banas' learn to python tutorial... that's how I learned. He explains everything really well!
Don't get IDLE, it's complete trash. You can use PyCharm community which is pretty good or any other besides IDLE such as Sublime Text, Visual Studio Code, or Atom should work well!
Next up: I programmed an AI to hack into military databases
*ISIS wants to KnOW yOuR lOCaTioN*
🤣
Then it turns out it just plays Exapunks.
*FBI wants to know your location*
I made a ai to hack your toaster checkmate bitch
Next:I created an AI which make AI
Don't you mean Cd
Wooosh
Pls delete your edit.
ConfuserM22 I deleted it Thanks for the opinion
B-bro thats a virus since it will know nothing but its own code so it just copy's it and makes another ai that makes another so it wont stop until all memory is full AND THE CPU WILL SUFFER
Looking though the comments, I’m beginning to wonder how better would my coding be if I just took pieces off the internet instead of trying endlessly until I even consider looking up the problem.
You get really good at walking when you stop thinking about it like it's QWOP
Dont know what CWOP is but yeah that mindset of “looking it up is cheating” is only gonna hurt you, at least at first. Instead, plagiarize code so hard that you learn how it actually works. Do that enough times with the same command and you’ll figure it out eventually.
AI DESTROYS Pong game with LOGIC and FACTS
Not even facts, just only logic. xd
HEY KID, WANT SOME HIGH QUALITY FACTS? Well check out India.super.facts on Instagram. (lol not my account just hillariously wrong facts)
@@owengrimm1370 First generation of ai's be like
AI: facts don’t care about your feelings, OK folks?
Who would win? : a smart ass machine able to make complex calculations faster than the conviced human speed or one prime boy
*BOII
Oof
Hooman
Arthur BM a soy boi
Arthur BM D z
CB: says he's gonna be more consistent, upload every week Me: was good to hear from you a month ago...
*Does 1 move in chess game* *Explorer crashed* AI won I guess
If you're having an issue where something like a number is in a spot that causes trouble...etc, you can just use opencv to just over it up with a black box or something. The ball will also disappear under it, but it's less likely to confuse the AI. When we play a shooter game in 3rd person, we also just cover up the main character so we don't keep trying to aim at ourselves, for example.
E
@@EEEEEEEE How are you everywhere. I thought maybe CB would be a safe space. I was wrong.
Do tetris please
patience, one day
3 years later...
@@CodeBullet People already did with tetris, do with 13x25 board pentris
@@CodeBullet One day. *23 years later* TETRIS
@@CodeBullet THY LORD SPEAKETH
For the wall bounce problem, you can reflect the entire thing over the bottom boundary, and have another paddle that mirrors the real paddle. You can then allow the ball to go past the bottom wall and try to hit it in the mirror world
Something says: *Evan respects his audience and is grateful for every single one of you*
This man's dedication. Actually doing work on the same day as his exams. Props man!
Was probably just putting off revision
He just finished his chunin exams
Next video - do this on an online Tetris game and beat real people with a perfect AI
Yes. Just yes
tetris is complicated, but it could work
Tetris is incredibly hard, since the AI cannot adapt past what it is told to do. It won’t stack to allow for combos or to conserve space, but to set down lines and clear space quickly. No AI can beat a pro at Tetris, and none will until someone figures out a way to make it think ahead. WHICH SUCKS BECAUSE PUYO PUYO TETRIS PRO NEEDS TO BE STOPPED.
@@AVerySexuallyDeviantOrange it can be hard. But its not imposible. Just tell the ai to build space for a tetris until it gets a line pice.
Guille p Having it decide where to stack pieces effectively to allow for combos is the hard part, I mean. Like, getting a full 4 lines (excluding a spot for the I beam) prepped up is exceptionally hard when you can’t use foresight on whether to fill a spot (such as using a T to fill in a single step on the left side of the matrix while a Z is in the coming blocks, rather than storing it and using the Z to fill the step and placing a T on top of it if an S is in the coming pieces) or if you should just keep building in the middle and wait for a more preferable piece to come along.
5:40 thank you for introducing me to this song. Fantastic
2:20 Wow Code Bullet, You have really grown since than in your programming skills!!
Python: I made an AI that play gta 5. CB: I made an AI that plays pong. Python: *face palm*
Why? That's how one learns.
Punocchio just a joke
Python is the programming language...
MR. ballstone Sentdex made the GTA 5 AI
I don't get this. Sendex made the GTA5 AI
Hey , just in case you want revisit the Pong game, or want to follow an object on screen in the future, have a look at kalman filters, they are quite mathmatical, but once you understand them, they are not that hard. They are used to track all sorts of things and are very fast ;) On another note, your idea to extrapolate the position of the ball, based on its velocity was a good start, but can still be improved. * For one, the angle the ball moves never changes, unless it collides with something. * You do not need to search the whole screen for the ball. You have a rough estimate, where the ball should be, just look there. If it is not there, then you can search other places * Just ignore the area, where the points are shown. The ball is not often there, and in the case it is really there, your tracking with the kalman filter should be exact enought. Hope that can help you (and others, who read this) out.
Das alotta words
Code Bullet: Making an A.I. to play pong Me: Struggles to make pong
Thank you so much for the vids I watch them all the time at like 1 in the morning and love them. You probably won't see this cuz it's an old vid but still.. thank you!
Ben Shapiro DESTROYS Marxist pong game
"Im going home, i am home" God 2071 Also "want some impresive AI FUCK YOU!"
With LOGIC and FACTS
Damn commies, better dead than red
That like how they title every right video lol I stopped trusting ben when he tried to disprove global warming and he started stating fact i knew were used to manipulate instead of educate Like saying antartic sea ice is growing But he does not explain why
I've been getting too many similar recommendations on my feed
AI Learns to play Tetris
ILiekFishes yes
Oh boi a nightmare
I remember there being an AI designed to play Tetris but when it was playing it paused the game because the only way to win that game is to not play and it froze forever.
10:32, “I’m gonna try putting a video every week” said code bullet on November 25, 2018
First off, nice work on the video even if it didn't go as planned, it's still better than what I would have tried. I am a beginner coder and was caught off guard on the website. The website really caught my eye because it looked like a similar layout to what my website class had us make. I was curious if you took the same class and by chance know the grade it got. keep up the interesting content and have a nice day.
you should have programmed the ball to hit the edge of the paddle so that you can actually score points instead of just hitting it back and forth.
I know this is way late, but exactly. He didn't program it to win, just to never lose. Not exactly the same. Maybe he could redo this challenge but tie neat into it with points scored in least amount of time as a measure of fitness.
If he did he’d probably have to use Q learning, to give a proper incentive for the AI to score points
This is a late comment because i can
do you even KNOW the sheer amount of bugs that would cause?
Space Chase literally no project never had bugs. Just because it might make bugs isnt a reason for him not to try it.
I love code bullet
Honestly can't help but love your voice, you sound so happy all the time wtf
i'd like to see more about your coding like how your class structure looks like, what methods those have etc.
8:37 "I'm going home. I am home."
Oh dear god, pong is back...
Angrywolf 378 idot...hm
On the next episode: CodeBullet builds an AI that can beat any enemy from the dark souls series withought taking any damage.
MrLeft Hand if he can build an AI that can best dark souls then there is no hope for humanity
@@bobbypage9982 lol
Ive actually programmed pong and and following AI in JavaScript... I didnt know I could get views for this damnit
rip
I no absolutely nothing about coding or anything about computers more advanced then what you learn about in high school. Yet I still enjoy watching you struggle to create these a.i.
Hey, I didnt look too closely at how you got python to "see" the ball, but some advice that made a huge difference for me: Taking a sum total of a screenshot value will allow you to quickly recognize whether or not the ball in in an image, or if it is a base image. What I would have done in this situation is take screenshots in halves until I had reduced the ball into a square space that is the same size as the length of the paddle. It's not important to know exactly where the ball is, only that it is inside the paddle area. So by having a prebuilt library of what the screen looks like without the ball, and summing those colors number value in comparison to what it currently is, and working in big chunks into a smaller square would quickly allow the program to give "good enough" data, and perhaps even make the wins more common, as the best way to win is to actually have the paddle hit the ball closer to the edge. If any of that makes sense.
It does
Totally
I see 'AI', 'Destroy', and 'Pong' in the same title and I click. Simple as.
I see Code Bullet
Pong destroy AI
never heard anhyone call the paddle a "pong" before Kinda dig it
I saw this video today when I was searching pong, and then played pong on that site you were using. On my computer on Microsoft Edge. I'm in KZhead on my phone. Nice.
ty code bullet for the effort i love your conetnt and would love to learn to this when im older so i can redo some of your AI
Next up: “I programmed my AI to do my homework”
How much for that
Next up, I learn how to make an original comment
You expected a name, but it was me, DIO! You expected a name, but it was me, DIO!
Me: Mommy, The Pong Cartridge Is Broken Mom: Oh, sorry, the CB mice must've gotten to it again. Sorry.
Dude, love your work! Haha!! Seriously inspiring. :)
Yeah... I am software engineer myself (that is how i earn money)... Question why not copy it from the site never even occurred to me, because i knew how hard it is to begin with... It is literally easier to create my own knock off from scratch than worry about reading someone else's game... I might have considered it for open source, but even then idk...
That's cool I want to be a software designer when I grow up or animate a show or video game
Do you devlop games? If so i just wanted advice as where to learn c# because i like to make incremental clicker games with unity
@@beelal6407 no i work in finance world. But if you want to learn unity, then free courses that are available on unity website are pretty good. They will give you basics of c# needed too, and then if you want to do something not so basic just google "how to do x in c#"... CB copy pasting someone else's code wasn't a joke that is how it is usually done, because you don't want to invent a wheel...
Wait do professional software engineers use scratch?
@@nutcrugger5123 no... Why would we? But a lot of things you do there still apply. It is just not generic enough...
Next up you should create an AI that creates an AI that creates an AI that creates an AI that creates an AI that creates an AI that creates an AI that creates an AI that creates an AI that creates an AI that creates an AI that creates an AI that creates an AI that plays Mario maker
I like Mario shut up
@@TheCodGamer-pr9pe ok.
Another potentially good solution would've been to take a screenshot in the first frame of the game, identify where the ball is and then, dividing the ball location into 9 squares, the 9 squares being equal to the surface area of the ball itself, depending on it's moving direction some squares from this small matrix would become black (unless it's near the score) and this way you could determine it's position way faster. The 9 squares instead of being determined each time from a screenshot, you program them to follow the ball, like a dynamic variable, only in your face type variable.
I've never taken a programming course or class. I picked up Python a while back and it took me a week to make my first dungeon crawler. Seeing you struggle with "simple" programming makes me feel less generally terrible. Keep up the content man, I relate to your frustration 10000%
I love your vids. This one was no different!
“I am just gonna plagiarize that” The real reason why he’s not in uni
Your profile pic needs Jesus
@@cheesychipmunk8382 indeed!
@@brandpotato3650 amen
>Copying code from tutorials and kind of piecing it together Yep, I can 100% confirm this is how coding works
The commentary of this guy is just awesome :P
You know it’s intense from the pong ball on fire
What?
Only on this channel do I get excited when the host starts with “This video is going to be a bit of a mess”. I immediately think “Oh, this is going to be good!”
(4:20) Logically, the ball should be about where it last was, so you have a much much smaller array to check. If the ball can't be found inside this array (aka someone scored), then check the middle column.
Right now it's still trying to defend each time which is prolly why it's taking so much time but it'll be interesting if instead of just defending it tries to see where the enemy paddle is and then hit it such that the enemy wont be able to reach it.
Program an AI that programs an AI which repliactes itself
Omar G worm to be precise, i think
Technically, a program that replicates itself is bacterium. If it does nothing but replicate itself, it is a Quine. If it copies itself over a network, it is a worm. If it injects itself into another program, it is a virus. If it cracks someone else's code, it's a logic bomb.
Isn't that how Terminator started? But it had robots too?
Breaking News: Local Programmer and Content Creator gone missing. If you see him, please do not provoke him with a computer and keyboard.
Just found that video and my eyes are hurting... Finding ball is sooo simple! You have to find it on screen matrix, remember position and then only check future possible positions, going two steps in the future, it's exactly 24 positions... instead of 100x100 grid if i saw correctly. So 24 instead of 10000 so over 400 times faster :D From the other hand, i'm a little jealous... The time You have for those is amazing. And content is great! So i'm sad i cannot subscribe twice...
Also, are all my favorite KZheadrs from Australia? What the hell? Am i the only one stuck in europe? ... Fuc107!
Thanks for that “Have a good day” at the end of the video- I know you didn’t mean me in particular, but I still genuinely appreciate it
Regarding the intro: You gotta remember, the people who complained ARE cinemasins fans, so they're not the brightest bunch.
how would you know its cinemasins if you didn't watch them? i didn't recognize it so
@@bluestonethe2nd Either you know CinemaSins, know their intro, and then go on to complain he ripped it off, or you don't and you wouldn't. No real grey area here.
Love you code bullet
WHO DOESN'T LOVE CODE BULLET!!! (don't answer that, i would like to stay believing no one doesn't dislike him lol XD)
A nice trick to speed things up, maybe: The pixels in the Pong game are fairly big, like maybe 4x4 or even 8x8 screen pixels? You could loop through the screengrab skipping every four pixels with range(start, stop, step). That would provide a 4*4 = 16 times speedup for locating the ball.
“If you “blow” the enemies pong go up,” nice phrasing
i bet you can't do this: program ai to learn to play trials fusion.
OH MY GAWD.... yes please
Oh god
While not an ai. You can use a TASbot. (Tool. Assisted. Speedrun. Bot) using this you can get a programmed robot to do the inputs making a perfect race
AI is just a bunch of If statements change my mind.
*injects AI into your mind*
René Kulik if or if then lol sometimes it's "to" like "to go"
No no no no no no its just a bunch of command blocks and invisible Armor stands
If than statements
Norrix he uses python so if else
Congrats on 1 Million Evan
I thought I was crazy when I programmed. But codebullet codetrain and sentdex are too much. Keep up the good work.
The fact that you don't excessively add comments to your code scares me...
William Coberly makes me feel better because I do not use comments... like ever.
I guess his code is for his eyes only
@@TheEclecticDyslexic i agree with you when i was learning python my teacher told me always type out the code so you can memorise it/learn it that way when you get a job in programing you wont need a reference sheet with 24/7
@@arya6085 Which is fine until you're working on a new project and remember something from an old project might be helpful and then you look at the code from the old project and wonder what the hell your brain was doing when you wrote it
@@derekegolf1474 Yeah, and if you're a hobbyist you might have projects that you work on for 2 months, forget about for a year, then come back to... Without copious amounts of comments, the typical reaction to that is 'wtf is this shit!?'. And that's when it's YOUR OWN code... Yeah... There are of course people that think excessive commenting is bad. And they do have a point in that if you're commenting stuff that should be obvious from the code itself that's kind of a waste of time, but also the more comments there are the more likely it becomes that the comments and code become out of sync. A comment that tells you something contradictory to the code itself is probably worse than no comment at all I suppose. But nonetheless I err on the side of excessive commenting, personally... Easier than trying to guess what bizarre logic I was using a year ago. XD
Next: "I code an AI which codes and AI smarter than their creator"
I like how cb doesn't even try to convince us that he doesn't procrastinate making videos
I would have just used the delta between two frames to interpolate a line. If the line crosses any of the pixels on the right side of the screen, the ai has to go to that position.
Hey can you do some sort of tutorial/example of using deep learning to do something like hill climb racing but randomized every time so it develops a strategy by reading the screen like how you had it read the screen in this video holy shit that made no sense hopefully u understood what i was trying to say
you mean like an ai that plays randomized levels, trying to develop strategies that work on most randomized levels, trying to beat them?
@@ToadRoasted yes and also using the screen video reading like he used here
Watch the sentdex video that code bullet mentioned, it does exactly what you want to know
But codebullet tho...
Noise algorithms
Make an AI to make AIs, so you're making AIs without doing anything.
That's how Skynet becomes self aware you dolt
the 2 frames used to determine direction can be used to determine speed. frame 1 gives point of origin, frame 2 gives direction and magnitude. the time between frame 1 and 2 is known. divide magnitude by time gives velocity. the 7 points issue could be solved by not only get the pixels of the ball, but the pixels around the ball as well, so the AI would look for something ball shaped. wouldn't work if the ball goes behind the score, or hits the paddles, the ball would be lost for a moment, but not as bad as constantly losing whenever someone has 7 points.
Nice, I programmed my own version of pong with an unbeatable "AI" a while ago. It was fun, even though I had no idea what I was doing, which is evident from the fact that I displayed the game on a "grid" made up of hundreds of divs by changing their class using javascript.
Next; *I programmed the AI to program the AI*
To program the ai to program the ai to program the ai to program the ai to program the ai
Hypersonicracing422 3 that would be good
Lololololololololololololololololololol
MATRIX
I used the AI to use the AI
Can't you just have the AI pong paddle to follow the y coordinate of the ball? _Unbeatable AI_
i dont think this would work because of the time it takes to process the "screenshots" so the paddle thing would be lagging behind
@@lixo03 wtf😂😂
@@gagewaterhouse4323 Sometimes KZhead is kinda buggy
I'd love to see code bullet on the cold ones podcast
I loved you using the cinema sin style intro
I really like your humor 😍 you are amazing, and your content is pure gold!! 😍
*Y O U D U M B M O-*
Ai learns to kill people
@@karltodd2772 AI already learned to do that it was the first thing we taught AI.
@@karltodd2772 *SKYNET WANTS TO KNOW YOUR LOCATION!*
You have like the best channel ever
loving your videos and webpage is awesome :)
Can you make an AI that doesn't suck at Civilization VI?
create an ai to make an ai that teaches that ai (edit) omg thanks for the likes , it's the most I've ever gotten !! also if you want u should sub to me :)
@N8WulfCommander honestly my guy. i know nothing about ai. I just watch these videos bc i think there cool. and made this comment bc i thought it was funny
So basically, amiibo?
Do you want killer robots? Because thats how you get killer robots
*Skynet wants to know your location*
*_create the singularity_*
Literally wish this man had a podcast
If you are working out the position based on velocity then there are only 3 places where you actually need to know where the ball is. Those are, 1: when it hits the oppsing bat, 2: when it hits the top and 3: when it hits the bottom. Take the frame where it matches one of those and the very next frame and build your velocity from that. then you can limit how much area you are checking to about 5% of the whole game area. should also solve the 7 issue