I Taught Claude Code to Play Tetris... It Broke the World Record
8:26

I Taught Claude Code to Play Tetris... It Broke the World Record

Nate Herk | AI Automation 11.03.2026 6 864 просмотров 218 лайков

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI
Описание видео
Full courses + unlimited support: https://www.skool.com/ai-automation-society-plus/about All my FREE resources: https://www.skool.com/ai-automation-society/about Apply for my YT podcast: https://podcast.nateherk.com/apply Work with me: https://uppitai.com/ My Tools💻 14 day FREE n8n trial: https://n8n.partnerlinks.io/22crlu8afq5r Code NATEHERK to Self-Host n8n for 10% off (annual plan): http://hostinger.com/nateherk Voice to text: https://ref.wisprflow.ai/nateherk I gave Claude Code the ability to see and control a browser, then told it to build 3 games and play them. What happened next was wild. It kept failing, learning from its mistakes, and getting better on its own until it eventually broke the Tetris world record. This is one of the coolest things I've seen Claude Code do. Sponsorship Inquiries: 📧 sponsorships@nateherk.com Timestamps 0:00 Browser Automation Demo 1:11 Teaching AI to Play Games 1:28 Game 1: Block Runner 3:26 Game 2: Tetris 6:09 Game 3: Checkers vs AI 7:24 How to Set This Up

Оглавление (6 сегментов)

Browser Automation Demo

Did you guys know that I'm actually a Tetris world champion? No, I'm just kidding. This is my Claw Code agent playing both of these at the same time. You know what's crazy is I looked up what is the Tetris world record score and apparently it's 40 million, which as you can see, both of my agents have just surpassed at the exact same time. And I'm pretty sure at this point I could go to sleep and I could wake up and they would still both be playing Tetris. So, I've been playing around with browser automation inside of Cloud Code to do things like filling out forms or searching through Best Buy results or downloading reports that might not have an API accessible. So, like in this example, just opened up that tab. It's going to flip to the next page with the form submission. And then it's going to go ahead and fill out those fields as you can see and shoot that off. Or in this example, it just opened up two tabs and I'm trying to resize these real quick so you can actually see. You can see that these are Best Buy tabs and it's going to search in one of them for laptops and in the other one for iPads. There you go. iPads, laptops. Hit search. And now it's going to be able to pull some specs for me if maybe I was in the market for a new iPad or laptop. And I noticed as I started playing with these more that when you run scripts like this, it has to learn. So it goes in there, it takes a screenshot, it comes back and it thinks, and then it updates its script, and it tries again.

Teaching AI to Play Games

So I started wondering if I could basically teach it to play games. So what I did is I had it build me three games. And so today, what I'm going to show you guys is me training the AI to play the game and learn and get better each time. So, we've got three different games. The first one's the easiest. The last one is kind of the toughest. And the last game I actually play against

Game 1: Block Runner

the AI live. So, it's going to be pretty cool. Okay, so here is the first game that it built me. It's a pretty simple just, you know, block runner game. So, the block is running. I hit space and I'm able to jump over these obstacles and each time I get a new point. So, obviously, I'm going to just be able to do this forever, but I'm going to let myself die so that we can come into Cloud Code and I can say, "Hey, I want you to open up the block game in a browser and try playing it. If you fail, understand what you did wrong and fix yourself so that next time you do better. And keep doing this until you score at least a 10. So, it read through the game and now it's building that bot to actually go play the game. Now, this is the easiest one. And really, what it should be able to do is understand exactly how many pixels away it needs to activate the jump. So, I imagine that this should be able to get to 10 pretty quickly. So, we should be seeing this browser pop up any second now. Here it is. Let's move it into view. Let's see how good this bot does. Okay, it didn't jump at all. Okay, now it's jumping too early. It's trying again. Okay, this is not going very well. All right, so close out of the tab. And now it's going to debug and update the script. I'm clearly having way too much fun with cloud code. It says I'm going to run the block game. Here's bot attempt number two. So here's the tab. Let me move this into view and let's see if it does any better this time. Okay, it's still jumping quite early. Once again, another early jump. Okay, this is pretty pathetic. Now, it does look like it's trying something different because now it's triggering two jumps. There's our first score. There's our second score. There's three. There's four. And maybe it's on to something. It's doing like a double jump. Come on. You can get to 10. There's eight. There's nine. There's 10. Wow. Okay. It literally got exactly 10. The bot scored 10 on attempt six. It worked. The strategy evolved through selfcorrection. You can see it's analyzing like the pixels of the distances that it needed to do jumps. So that was the second time. I could probably get this to do one more iteration and build this bot so that it

Game 2: Tetris

would literally never lose. But let's move on to game number two. Okay, so game number two is a classic. It is Tetris. I can rotate the blocks. I can move them down slowly or I could hit space to hard drop them. And wow, I've got a line. But this is actually really cool to me because I literally oneshot prompted all these games and I said, "Hey, I want to build some games and then I want to have you be able to test them. Give me some ideas. " It threw us some ideas and I said, "Yep, go build them. " And it just built them all. So, this is super cool. Obviously, I'm not going to play this. Let's go ahead and just die. And now, let's see if Cloud Code can play this. Well, all right. So, now I said your next task is to open up a browser for Tetris and play the game as fast as you can because I don't want to watch it just slowly drop blocks. I want to see it rotate them and slam them down and just do it as fast as it can. So once again, it's going to read the codebase to understand how the game works and then it's going to go ahead and write a script for a bot that's going to play Tetris. Oh my gosh. There's no way. Did you guys see the bot just score like 16,000? Well, that was kind of crazy. Okay, so now I'm saying, "Hey, can you open up two different tabs and get them to get to 25,000 points? " You don't have to hard drop every piece immediately, but you just have to do it quickly. That was so crazy, though. I was not expecting that. All right, so here are the Tetris tabs. Here's number one. Here's number two. Let me get these lined up. Okay, so now the tabs are both running. We've got two going simultaneously, and they're doing better at not dropping as fast, so we can actually see what's going on. This guy right over here put a vertical line in a horrible spot. All right, drop a comment real quick. Which one do you think is going to win? Cloud code number one or cloud code number two. You can see though like there are some things that it messes up on. Like this should have been placed down here and sometimes it just doesn't rotate. Like same thing over here, but it looks like they're kind of getting near the top now. So this one on the left hand side has died and it got about a fourth of what it did earlier when it was literally speedr runninging through everything, which is kind of interesting. Okay. Okay, and now they're both dead. And they didn't even get past 6,000, which is kind of interesting to me. It said that the 2C delay is actually making it worse. So, I'm going to go back to the instant hard drops. Okay, so both of them just got over 25,000. One got 47 and one got 38. And now I'm saying, okay, cool. But now, let's hit 80,000. All right, guys. I think I cracked it. We are just pushing now 4 million. You know what's crazy is I looked up what is the Tetris world record score and apparently it's 40 million which as you can see both of my agents have just surpassed at the exact same time. I genuinely don't think that they're going to lose anymore. So I'm going to go ahead and call it a day. We're going to close out of those sessions and they definitely crushed the 80,000 mark. All right, so I'm going to go ahead and

Game 3: Checkers vs AI

clear out of the session and we're going to move on to the last test which honestly is not going to be as fun as that one we just did. But this one is me playing against the AI in real time. All right, so I'm just going to say let's play checkers. That is the last game that it built for me. So hopefully it knows to spin up that browser and we'll play against each other. And I'm fully fully expecting to lose. So it's going to start up the game server and then it's going to launch the checkers bot. All right, here we go. So I am gold and the AI is red. I haven't played checkers in I don't even know how long. So I have no strategy going into this, but we're just going to go ahead and get started here. What I do know though is when you get to the other side, then you can go backwards. So I like I said, no strategy. I'm not feeling great about this game. Yeah. Yeah, I think I lost already. That was brutal. Well, it's four on four. I maybe could still make a comeback. Oh my gosh. I thought I outsmarted it, but then I realized that you can't outsmart the AI. So, okay, I just lost.

How to Set This Up

I don't really feel too bad about myself, though, because the thing just scored 46 million in Tetris. But anyways, that is going to do it for this video. I just wanted to show you guys what I thought was kind of a cool use case. But really think about the practicality of what this actually means. Cloud code can now do anything that you would do on a computer. With enough training and once you build some skills around those scripts, I think that this is going to be super cool. And I'm definitely going to be diving more into some computer use automations. And if you're curious on how I did this, literally what I did is I opened up a new session. I came in here into plan mode and I said, "Hey, I want you to be able to use my computer. the browser. Do some research, figure out the best method, and then go ahead and just install what you need to install. " It ended up using Playright's CLI, so that's why you saw all those bash commands. super seamless, super simple, and you guys already saw that in action. So, if you want to play around with it, go tell it to figure out how to install the Playright CLI, and it will just do it for you. So, if you guys enjoyed or you learned something new, please give it a like. It definitely helps me out a ton. And as always, I appreciate you guys making it to the end of the video. I'll see you on the next one. Thanks, everyone.

Другие видео автора — Nate Herk | AI Automation

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник