I Created a PERFECT SNAKE A.I.
HTML-код
- Опубликовано: 27 ноя 2019
- I used math, science and tears to create a snake AI which always wins (sometimes).
Massive thanks to brilliant.org for supporting this episode, check them out here: www.brilliant.org/CodeBullet
Also check out John Tapsells work: johnflux.com/
Heres my stuff
Twitter: / code_bullet
Patreon: / codebullet
Discord: / discord
Art created by @Dachi.art / dachi.art
CB Viewers: “Why is he taking so long to upload?”
Code Bullet: *Throwing out entire weeks of progress for shits and giggles*
CBT viewers: ouch my balls
CB veiwers:.... Wait what the fuck? Why?
Code Bullet: cause fuck you and fuck me that's why
-
Also no sharing code
tremonk
I don’t play Fortnite.
“He didn’t die, he just kinda gave up” This hit to close to home 😂
Me comment first
I couldn't tell if that referred to an AI snake or to Code Bullet, both seem appropriate
Punky Plays So?
This snake Ai is my digital spirit animal.
5:44
A code bullet GPS would just be “keep doing random shit till something works” and then take the best of all those failing methods rinse repeat till we’ve got a route
Also new roads won't be added for months to a year
Just go for the longest path duh
Dude if your GPS was actually like that, I'd totally buy one.
Sammmmmmme bro
We all would
Me four
Yea
HELLA FUCKING YES!
This guy always sounds like someone just told him a clever joke that wasnt quite good enough to make him laugh but made him smile widely through the rest of the conversation
Strangely specific.
Satisfying and specific
Strangely specific, but not wrong
Basically exactly like Daniel Ricciardo...
Which translates to the viewer. The process is fun to watch though
If: gonna run into self
-don't.
deep shit you got over there
If: hungery
-eat
Function.repeat
Evija Cernisa what bloody syntax is that??
accualy it goes like this in java
if(head of snake touches self){
user is dead;
}
this is pseudocode
@@laserbeem6692 else { dontDie(bool justDont = true) }
I love how it doesn't even look like a game of snake at one point on, it just looks like a green box with random changing lines and holes
4:36 the rare footage of a coder actually *writing its own code* instead of copying.....
what an amazing discovery
Hi bro >:)
Yep, that's Code Bullets content and it's so satisfying to write out working codes and scripts.
If you’re not recording a video to showcase your talent what’s the problem with using a code that’s already been written to speed up your process?
In light mode too
We meme it all the time but usually we do get our hands down with programming the details in lol
First rule of snake: snake eat apple
Second rule of snake: under absolutely zero circumstances does snake eat apple
Third rule of snake: NO HOLES
Fourth rule of snake: don’t die lol
Fifth rule: dont not cheat
The thing at 19 40 looks like plant vines. Also I randomly pause and it was at 19:55, funny number.
Paradoxically paradoxical
"The snake will get pissed off and take an angry nap" is a phrase I need to use more in my life.
Ig im a snake then
finally 👨🏾🔬 sleeps furiously
@@abacussssss can you sleep depressed
Y_onis I do it everyday
@@y_onis7038 what about sleep neutral, happy, ecstatic, manic, sad, miserable, angry, enraged, afraid, (mostly me LOL) and stressed out?
yes, omori reference
I’ve been watching him for a good bit now, and just now realized he codes IN LIGHT MODE. Anyone that codes in light mode is secretly burying some bodies in their backyard
Me: no, Michael Reeves codes in light mo... no that checks out
(In some of his old videos at least idk if he still does don't @ me)
Checks out. He killed Adrian. And Adrian killed like 5 fully-trained soldiers, but Adrian died nonetheless.
@bestintheband5114
You should figure out a way to convert these AIs to be screensavers. I'd legit pay 99 cents for them
Same
I'd pay atleast one dollar and 1 cent
I would pay a whole Enigma Machine Part 2 video
@@ratt__mann92201 dollar and two cents
"The snake will get pissed off and take an angry nap"
This is me trying to do calculus hmwk
Anything related to school and fuck me
dat h is ur names combined
@@user-gt7jk3lt4t h
@@fitriasukmawati3762 h
@Rybot666 Morgan h
I like that everyone just looked over the fact that adrian single-handedly killed _at least_ 5 fully-trained soldiers
But still can't find the obvious apple
@@JavaMR hes a marine
Was a piece of cake
@@JavaMR hecu
Brody Frable more than soldiers they were generals
Near the end Even losing his sanity over 2 blocks is like the Sargent losing his mind and screaming "4 FUCKING PIXELS"
Thats some serius 096 lore right there for how long have u been in the scp community?
that isnt even serious lore, i think its a pretty well known thing
"Two. FUCKING. BLOCKS."
*SANITY*
@@ziyadessoufi2052 thats literally the most common piece of 96 lore aside from its abilities
3:37 there are only three possible moves at any time, since the snake can't go back.
and not to mention walls and corners
Programming:
"Omg, i can't believe this really works!"
"Omg, of course it didn't!"
I can get like that half-way through the first sentence sometimes.
"omg I can't believe it didn't works!"
My teacher gave us an assignment. This was a comp 101 course, easy stuff. I spent days fixing output spacing. When it was done, I couldn't tell you why the spacing worked. I couldn't tell you why some lines were needed. But it passed the test class so...
Programming is like trying to teach how to swim to a tomato.
i love how Code Bullet can disappear for months on end consistently and then release a video that'll almost immediately get on trending, i like to think he's created the perfect AI to beat RUclips
its the two AIs trying to communicate
@@NatapixAS Maybe the snake is trying to spell 'send help'
DaBlackFoxAlt 'cept trending is hand selected by RUclips staff
@@Nate-bd8fg wait, does that mean that they picked a "vulgar unfamily-friendly" channel for trending? Since he swears in almost every video, including this one.
He's the Jontron of coding.
18:32
it now just looks like a black snake in a field of grass
20:51 When your download gets stuck at 99% and gives you an error after 12 hours of waiting.
RIP Adrian 2019 - 2019
Forever in our hearts
Even though he was a fucking disappointment, he's still somewhere in there. Probably.
I feel attacked
bro Adrian's a menace, he killed a lot of soldiers
@@advaithremesh1698 good
Ace Of Diamonds ehhhh
Plot twist: it was him playing the whole time, hes spent years training
Years of academy training, wasted!
All that time he wasn’t uploading he was just training
Plot twist: the actual ai is code bullet, created to produce ai offspring and making a little money through it on the side.
plot twist: it was actually u playing the whole time
not years just 4 months of playing snake
i like how a completed snake board becomes a maze.
I hope this is made into a wallpaper. It’s quite satisfying
Ai: misses by one pixel
Ai: this little maneuver is gonna cost us 51 years
This made me laugh so loud 😂
@@blessed6336 r/youngpeopleyoutube
@@blessed6336 LSL instead of LOL
@@thingytheretxrd ???
@@thingytheretxrd You don't even know how to use r/youngpeopleyoutube correctly.
"This solution is just riddled with issues"
*Still plays snake better than me.*
Idea: make a minecraft AI that is atleast capable of beating the game
Mailed comment 2
DeeVee hey do you know what the storm light archive is?
He's not actually playing it. He's just figuring out the best algorithm and letting a computer do the rest.
@@urinetrouble0543 If I know what Stormlight Archive is? Sir, I *live and breathe* by Sanderson's books.
Eric Lemaire, Jr. they never said he was playing it
I can’t be the only one to give the snake a voice when it went into “survival mode”. Like every time it did, I would just hear it screaming “SHIT FUCK GOTTA LIVE GOTTA LIVE OH MY FUCKING GOD GOGOGOGOGOGOGOG” or something.
You are.
Naw I did that too
easy way to fix the ending: when Hamiltonian step value of tail - head becomes too small, i.e. snake has grown wayyy too long, then stop implementing shortcuts. It will help with:
A) Winning
B) Winning efficiently; the item gets spawned on the blocks which are empty, when the snake is long and skips small steps on the cycle, then it creates small pockets which increases the number of Hamiltonian cycles the snake takes.
Awesome video, love the content!
If the robot uprising starts with Evan,
*_It probably won’t last long_*
Hey ! Take this more seriously , if they have 5000 attemps they may be even able to leave the room they started in
@Anime_Edits i cant tell if thats real or not
@Anime_Edits ohhhh that one
this implies 1 of 2 things. either he'll win quickly. or he'll fail quickly
No no it will be with Machine learning. So much shorter
Code Bullet in a nutshell:
Angry man cries his way through life whilst complaining about the things he loves
so basically every programmer ever
Alex I this is very very accurate😩
Ahem ahem michael reeves
Yes
Make a ai that can play geomechery dash
You forgot the amount of times he cried so much he just left youtube
Damn after a while the patterns it made got so hypnotizing
It was so good though that whole run was amazing! The literal issue was the simple ineffeciency that it couldn't perfectly optomized based on it's tail, because it doesn't check literally every step where to reroute, or is capable of planning ahead.
If it could plan ahead how many steps it takes to reach the point the tail would be at by that many steps, it could include that as the possible location for it to travel through, and end up optimizing it's movements, potentially perfectly following it's tail to buy time. Instead it's very visible that it does periodically check, but still tries to avoid it's phantom tail.
I swear, Evan is going to end up building the Terminator.
Didn't he already do that? His Clicking-AIs are able to open command prompt and to hire virtual gunmen. Just some more features or bugs and glitches and boom: Terminator
Lol
*accidently
He'll be able to once he cracks enigma
He is going to be a terminator
This would be an awesome like monitor background just a constant repetiting game of snake for your screen saver
found a background on Wallpaper Engine that literally randomizes a maze and solves it.
Someone needs to make this happen
@@failtronic2646 what is it called
@@slxpperyy9796 steamcommunity.com/sharedfiles/filedetails/?id=1550989740
The whole thing is customizable. You can change the color of the maze maker and solver, the wall color, the background color, and you can change the speed of the maze maker and the solver. Real cool stuff.
Ooooooooooooooooo Fiat hi FFFFAAAAAKKKKEEEE
3:07 I just realized that CB scared the driver so much, they gripped and tore part of the steering wheel off.
i love how at the end, it seems as though the leftover spaces made by the movement of the snakes tail is the snake
"I'm back guys!"
The best part of Code Bullet is him pretending to be a consistently uploading youtuber
It's very consistent, at least one upload a year!
@@jovan0454 That is true
And calling when he uploads a “schedule”.
it could be an aussie thing cus both of us just cant ever be bothered to upload
and i just started like 4 months ago or something
@@jovan0454 it's been 11 months since the last upload, is he gonna be able to one upload a year?
My anxiety reaches a whole new level when the snake circles the apple and leaves the smallest opening
268 likes and not a single reply
Kijjjjjhnuhiuybgujvvkguvjugvugvigyvyguvuytvjytvyjv
@@stromegy5792 saaaame bro
While I love watching these videos awake and aware, they also make a good sleep aide for the second+ watch. It’s a “teacher is talking about something I find interesting but have a rough time understanding and also I did not sleep last night so I guess it’s now nap time” vibe.
So thank you so much
Instead of taking melatonin for my insomnia, I up your view count
For some reason the designs the snakes body makes are so smooth and satisfying
2019: trying to beat snake with an a.i.
2020: trying to build an a.i. to hack Nasa
2020-2030
@@dragon5776 =-10
Ok boomer
Wabbit Seasonz no u
Nah m8 the a.i. Will hack into Space X
Snake: *turns red*
Snake's AI: current objective: *SURVIVE*
Current objective*
@@jjmj4971 Thanks
Translated into Code Bullet speech: Fuck! Fuck Fuck Fuckadie Fuuuuuck!!!
this was surprisingly cool, I also liked watching the first one it was so suspenseful and i really thought it was gunna work
For people who didn't hear Code Bullet over the sounds of Adrian getting murdered:
"Ok, back to the drawing board. The whole Q Learning thing didn't go super well so what we're gonna wanna do is get rid of all Q Learning and then some fancy sh*t and just break this problem down into it's bare basics"
1950: I bet they’ll have flying cars in the future!
2019: DIVEDE BY
M A T H N ‘ T (3:55)
Fun fact, flying cars exist, but no one is allowed to use them because there aren't any laws for them
@@Zergliskful it is not a fun fact if u cant fly them cars
1950: cold war
2050: robot ai war....or may be not war.... girl robot sucking my popo
The future could be 1951
Jeunesse Global uhhhhhhhhhhhhhhh take my thumb
Evan: "im back"
Me: "dont do that, dont give me hope"
cocaine cola GUESS WHO’S BACK. BACK AGAIN. SHADY’S BACK. TELL A FRIEND. Also, great name dude👌
Bet he’s sorry he couldn’t give it to you sooner
*You regain hope but a person you love falls into a pit*
If I were to fix the pathfinding one I would try to make sure the AI always knows where the tail has been. That way it can follow each place the tail has previously been in survival mode. That way it will never get trapped by going into places that are technically 80% of the remaining map, but are traps. Think about it, if you follow the exact places the tail has been, then you will never get trapped because those paths are constantly being cleared
“He didn’t die, he just kind of gave up”
Buddy that’s most of us now a days
@Griffin Dale shut up
Darth Occlus wut
Waaaaay too real.
i was watching your comment when he literally said that xD
@@Iorvethfox why are you being salty about his comment he was being nice
I like it when the snake just stops moving and gives up
"Eventually, Kars stopped thinking..."
@RYAN JIANG *NICEEEEEEE*
Still waiting for him to post something
That’s at 5:38
#unexpectedjojo
OH FUK
IS TAT A JOJO REFERENCE
I really liked your snake that tried to circle the food before killing it. Like some boa constrictor. Only time I've seen a strategy like that.
Also you should be able to hugely optimize the hamiltonian loop; the food only spawns in empty places, so you can systematically have the snake occupy space in a way it forces food to spawn elsewhere, so if you - for example - choose to split the screen in 4 quadrants, you could start by having the snake loop in 1 quadrant and leave its tail there so only the remaining 3 are free to move (and have food spawn in them) so it doesn't have to loop the entire cycle, and as it gets longer occupy more quadrants until everything left is 1 quadrant
It’s not an ai, he’s just really good at snake
Plot Twist
Lmao
That’s why he took so long... coudn’t do it by A.I. So he became the best snake player ever.
@RedPanda250 wooosh
Why do people always say this about this guy?
Best strat is to move all over plave and not take frut into consideration after reaching certan lenght.
Like you must go trough every single square from keft to right leaving single line free on left or right and when you come back from top you repeat lines from keft to right.
That has got to be the most satisfying video of snake I've ever seen
Three rules to win at snake
1: always have a direct path to your tail
2: never create enclosed space
3: never create dead end
4. Don't lose. This can also be 1.
Just be good at the game 4head
dont travel along the edge unless needed to get the next food
Mathrilord easier said then done
Wait, the flaw with the first rule for the AI will just continue making its circles because of the fact that ai will follow its programming
13:00 was SUCH a "fuck the apple, I NEED TO LIVE" moment
hahahahahaha
Suzaku be like
haha naice
Or as I like to say “OH SHIT OH FUCK ON NO GONNA DIE I WAS SO YOUNG”
I thought you said “f the people, I need to live” and it was so powerful ngl
This man is the result of all the rage, frustration, and stress it takes to learn to code.
The extremely large game towards the end of the game is unironically extremely beautiful and fascinating to watch. I actually went back and slowed down the playback speed so I could follow the movement (admittedly only slightly) better
"Let's make it 10 times faster"
"Alright 50 times FASTER"
"100 times FAYESTER"
"1000 times FAYASTAH"
Let's make code change his upload schedule like that
Me watching at 2 times speed
"2000 times FAYASTAH"
me watching from Spain
"1000 times FIESTA"
Code Bullet: It’s perfect!
The snake: *I’m ‘boutta end this man’s whole career*
I’m not a rapper😂
Watching the snake go around was super satisfying, love it
I would genuinely use a recording of this as a screen saver because it looks so cool
Title: “Perfect Snake A.I”
Me, having seen his last 12 snake A.I videos: **Doubt**
Press "X" to doubt
Z
X
C
V
This would be the coolest screen saver.
Oh man, that's an excellent idea
Code bullet going crazy or the snake A.I
@Your Pal Ryder Both would be fine.
Look at the names of the top 4 people not including me
@@victinistealth5756 I don't get it.
4:59 It should find the shortest path from the head of the snake to its own tail. By the time it gets there, the tail has moved. While the head is following the tail, it cannot die.
It should find the shortest path to its own tail, that also includes the fruit if possible.
But, it increases in length when it eats the fruit, so its tail will not always crawl forward out of its reach.
I would love to have an animated wall in my room with this AI going all the time
And when you turn it off the snake resets it's size and position
You know a snake player is good, when it’s snake looks like an Aztec temple
Lel tru
F u 2
AAYYAYAYYAAAYYYY
lmao y didnt i think of that.
Ikr
"2020"
"New year, new me"
"I'm going to be a free man"
That aged well...
/´¯/)
/¯ /
/ /
/´¯/' '/´¯¯`·¸
/'/ / / /¨¯\
('( ')
\ /
\ _.·´
\ (
\ \
if you are wandering i copyed and pasted this and remade this XD
@@A-400 Okay? And?
@@A-400 who asked
Nikola chill it's just a comment. And no, It's wondering, not wandering, as in "my brain is wondering how Nikola Anthony somehow has less brain cells than a hard boiled egg" vs "Nikola Anthony is wandering through the entirety of Reddit trying to find someone more virgin than him, but alas to no avail"
Guys, chill, this was a month ago
1:40 This is a masterpiece of combat, the effects, the visuals itself are just beautiful
Having this for a screen saver would be amazing
And like that, he’s gone again....
Rip
We have to wait another 5 months
*Goodbye, change da world*
@@orange993 lol
can i ask a question what programming languages is he using?
yaboi returned form the grave!
Very yes
Dani stop commenting and go back to drinking your milk
*M I L K*
Milk gang unite
Hey, wassup
I would be interesting to see him go back to this and make a change where the head of the snake had to be a certain distance away from the tail while following it. I think that would actually be a much easier way of playing it, since that would only let the snake follow the spaces that the tail leaves open while also eating the apple. Now, he may have tried that, and I can't remember since I am writing this at the end of the video. Just an idea.
11:44 is this the intro to an 80’s “hacker” film
I am *THE* hacker
Funny how at the end it looks like a black snake moving along a green grid
yes.
yep
Mellow looked more like a green snake to me.
Yeah
@@gamingunner128 me 2
"I'm sure you can tell when it goes to 'Oh shit, Survival Mode"
Well yes when the snake goes all blood red like it's hunting for lives
Judging from the part where the broken snake literally beat up the army, yeah it probably IS hunting people
There is something almost hypnotic about watching that snake do its thing. I enjoyed it.
my best snake pathfinding algorithm:
get x and y distance to target location
if x > y then add x to list, then add y to list (or -x / -y depending on direction etc) so the moves are listed in how optimal they are
then just make a list of moves that wont immediately make you lose and get the first optimal move in the possible moves list
lol i was too busy rewriting the entire rendering engine to make a proper ai for my game but there's like 10 enemy snakes that are hyper aggro XD
Lol imagine him trying to keep a straight face making the sounds for the military scene.
MATISTHERAT it’s really not that hard to do that especially since he doesn’t have the maturity of a 12 year old
why would he need to keep a straight face tho?
TBH that was a rather accurate depiction of military - they kill a bunch of people and things only get worse.
@Spit Dragon well not for me, if you told me to do that voice ,i would take a few weeks
B it’s meant to be funny. It’s the point and it fucking was
He sounds like he is smiling as he's talking.😆
@@oldpremium1493 yes
@@oldpremium1493 Moron
Anal?
Kylee Alanna that’s because he’s a massive fruit
@@tba2204g fxk
Honestly with how much you upload the into is accurate
i love the part where he said "it's snakeing time" and then snaked all over everyone.
O_O
😶😶😶😶😐😐😶😐😶😐😶😐😶😐💩
When the snake starts writing Latin and your sleep paralysis demon gets upgraded to a paralyzing demon
@Kamarious Antonio Temple
Shut the fuck up, and stop your god damn lies
Kamarious Antonio Temple this is the reason I watch videos 4 or 5 hours ago
Nobody:
The snake when it turns red: *NEW OBJECTIVE- SURVIVE*
Halo reach, best halo
Cake 4life what
@@theworldsdankestparanormal9805 new objective-survive is a halo reach reference
@@Dy1an.k i mean.....
@@EonsEternity what, it was defanitly a halo reference
Zoomer
I love the wave effect you can see when he increases the speed of the hamiltonian snake
10:00 it’s honestly both so satisfying and so frustrating to watch the snake trying his best to not touch the apple.
2019 : Perfect Snake A.I.
2029 : Perfect World Domination by A.I.
2059:pefect *dies from poisond oxygen *
Just throw an apple
August 29th 2029, keep that date in your diary.
Yeah pretty much
*SkyNet has entered the chat*
Making a perfect “Snake” AI in “Python”....
h o l y s h i t
Why does Python live on land?
It's above C-level.
I'll show myself out.
@@daburgerbandit1598 👏👏👏👏👏
Y E S
HalftuberWasTaken yeah
Whilf observing the snake in its natural habitat, scientists recorded some strange behavior, the snake seemed to go from 7 to 12, they where quite confused due to the fact that they didnt listen to codebullets commentary, and instead paued attention in class
If he does end up building the terminator, you know he’s gonna steal it from someone else 😂 (love you Evan)
Plot twist: he was the one playing and he is secretly the best snek player ever.
@spider man snek
@CreeperFun12 snek
@CreeperFun12 snek
No, it's in the title, ai, NOT human
If you can't figure out the difference between a computer program or ai player you should get some help
@@idropgp8052 r/woooooosh
2019: building AI to beat a game !
2025: recreating skynet!
Quantum _ this is the first comment
Skynet already exists, I work there.
@@Thisismaintv "recreating" like re-create -_-
LMAO
@@Thisismaintv you OBVIOUSLY work there with that much iq
The problem with the second ai might have been that even though the snake's head could reach more than 80% of the empty spaces, when the snake is really long (and so there are very few empty spaces) *the snake could still get trapped in that 80%*. The solution to that might be to add a conditional for when the snake becomes really long, it starts following the Hamiltonian cycle that he used in the last ai.
for some reason this feels very satisfying
He didn't realize the snake was still alive. It's head is right next to the tail
2awesomegriefers OMG you're right! EVERYBODY NEEDS TO UPVOTE THIS COMMENT! It actually would have finished 😂
He should have made the head look different to the body segments. Eyes or something. That would allow you to visually see that it's still going.
Witch timecode ? :o
Nicolas Gaillard 20:51
@@ironcode Erf. I looked at that time, but didn't see it. I'll try again at 0,25 speed.
Code bullet: take the longest path to the apple.
AI: *starts recreating the actual game to then get the apple*
the AI is recreating the big bang, the evolution of Life, the history of humanity and then gets the apple
Don't forget paying off it's college debt
CB: get. Dot.
A.I: Live?
CB: no. Get dot.
A.i: I'd rather live, fleshbag
@@PandaXStorm adam and eve lol
2:10 i am a subscriber now
Respect to cb for making this but I spent almost half an hour watching a green line on a screen
Corn Roof i mean, sometimes it turns red
Sneks
There's a dot, too
Corn Roof lol
how about a binary search before you watch. Start in the middle man!
19:05 "This algorithm is cold and calculating"
Ah yes, the floor here is made out of floor.
Ah yes should be hmm
@@wariothief well, oh yes but actually hmm
捌拾柒Idiot lol
Usually floor is made out of wood or concrete 🙄
@@marcusaureliusregulus2833 you must be fun at parties
I actually would like to use both of the latter algorithms. It might be interesting as some type of texture generator.