Home DeepSeek R1 – how to build a browser-based retro video game with just a seven-word prompt – yup, this has blown our mind

DeepSeek R1 – how to build a browser-based retro video game with just a seven-word prompt – yup, this has blown our mind

Okay, okay so we have covered DeepSeek a lot today. We have told you how you can use it on just about anything, including your own computer and we even dipped into to see if was safe or not. There are a lot of nefarious bad guys out there on the interweb so we we put ourselves (well we put Joel) at great personal risk so that you don’t have to.

Having decided it’s safe enough to play with we thought it was time to put it to the test to see what it can actually do with the bare minimum of interaction from us. Because we are lazy.

Now, I have tried getting AI like ChatGPT to build me basic retro games before and had a decent amount of success with ChatGPT but with a fair amount of back and forth. I decided to let DeepSeek’s DeepThink R1 reasoning model do a bit of work for me, and, yeah it was pretty astounding.

The seven-word prompt

I am no coder. I can barely add up to be fair. My prompt therefore was always going to be the most basic thing imaginable. I went with the intricately designed:

“can you build me a pacman game?”

The impressive thing about DeepThink R1 is it then sets about reasoning what you want. In this case DeepThink immediately decided that as I was asking such a stupid question I probably wanted a basic version of Pac-Man I could easily play in a browser. In truth I hadn’t even thought that far ahead, but sounds good to me.

And off it went. After a couple of minutes of reasoning which you can see below then it started writing code and then put that code into HTML so I could save it as a HTML file locally, or even hit the RUN HTML button that will run in a pop-up window there and then.

Deepthnk code

DeepThink’s reasoning

Okay, the user wants me to build them a Pacman game. Let me think about how to approach this. Since they’re asking here, probably they want a simple version that can run in a browser using HTML, CSS, and JavaScript. That makes sense because it’s accessible and doesn’t require any installations beyond a web browser.

First, I’ll outline the basic components needed. Pacman requires a maze, the Pacman character, ghosts, dots for the player to collect, and scoring. The game loop will handle movement, collisions, and rendering.

I’ll start by setting up the HTML structure. A canvas element is essential for drawing the game. I’ll also include a score display. Styling with CSS can make the canvas look like a game board, maybe with a black background.

Next, the JavaScript part. I need to create the game elements. The maze can be represented as a 2D array where each cell indicates a wall, a dot, or an empty space. For simplicity, I can use characters like ‘W’ for walls and ‘.’ for dots. The layout array will define the maze structure.

Pacman’s movement will be controlled by arrow keys. I’ll need event listeners for keydown events to change Pacman’s direction. The ghosts can move randomly for this basic version, changing direction when they hit a wall or after a certain interval.

Collision detection is crucial. I’ll check if Pacman’s next position is a wall. If not, move him. For ghost collisions, if Pacman’s position matches any ghost’s position, the game ends. Dots collected will increase the score, and when all dots are eaten, the game is won.

Drawing the elements on the canvas: Pacman can be a yellow circle, ghosts as colored circles, walls as blue lines, and dots as small white circles. I’ll use the canvas API for drawing these elements.

The game loop will handle updating positions and redrawing the canvas. Using requestAnimationFrame will ensure smooth animation. The loop continues until the game is won or lost.

Testing each part step by step. Maybe start by rendering the maze, then add Pacman’s movement, then dots and scoring, followed by ghosts and collisions. Debugging any issues like incorrect collision detection or rendering glitches.

We initially had a few issues even though the basic maze and characters were fine, but Pac-Man wouldn’t move. The first attempt to fix that resulted in a white screen and no maze but with little more than me feeding it a line such as “it doesn’t work because”, DeepSeek corrected its work and before long I was moving a circle around, collecting dots and being chased by other dots.

deepthink broweser

Now, is it the perfect version of Pac-Man, of course not. Did it take less than 10 minutes with next to no input from me, yes it did. The thing that freaks me out the most is I collect arcade games. I have an original Pac-Man cabinet behind me. The arcade PCB is the size of a sheet of A3 and is packed full of chips and transistors. It probably took a bit longer to iterate that it just took me.

The biggest problem I countered with DeepSeek during this process was suddenly kicked me out and then I couldn’t access my previous chats and I still can’t. I am assuming right now the servers are beyond hammered due to its meteoric success. So you may have to hold tight until things calm now.

Meanwhile, I am off to get it to write me a new Final Fantasy game next.

About ReadWrite’s Editorial Process

The ReadWrite Editorial policy involves closely monitoring the tech, gambling and blockchain industries for major developments, new product and brand launches, AI breakthroughs, game releases and other newsworthy events. Editors assign relevant stories to in-house staff writers with expertise in each particular topic area. Before publication, articles go through a rigorous round of editing for accuracy, clarity, and to ensure adherence to ReadWrite's style guidelines.

Paul McNally
Gaming Editor

Paul McNally has been around consoles and computers since his parents bought him a Mattel Intellivision in 1980. He has been a prominent games journalist since the 1990s, spending over a decade as editor of popular print-based video games and computer magazines, including a market-leading PlayStation title published by IDG Media. Having spent time as Head of Communications at a professional sports club and working for high-profile charities such as the National Literacy Trust, he returned as Managing Editor in charge of large US-based technology websites in 2020. Paul has written high-end gaming content for GamePro, Official Australian PlayStation Magazine,…

Get the biggest tech headlines of the day delivered to your inbox

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.

    Tech News

    Explore the latest in tech with our Tech News. We cut through the noise for concise, relevant updates, keeping you informed about the rapidly evolving tech landscape with curated content that separates signal from noise.

    In-Depth Tech Stories

    Explore tech impact in In-Depth Stories. Narrative data journalism offers comprehensive analyses, revealing stories behind data. Understand industry trends for a deeper perspective on tech's intricate relationships with society.

    Expert Reviews

    Empower decisions with Expert Reviews, merging industry expertise and insightful analysis. Delve into tech intricacies, get the best deals, and stay ahead with our trustworthy guide to navigating the ever-changing tech market.