JavaRush/Courses/Claude Code SELF/Building a game from the spec

Building a game from the spec

Open

1. No spec, no result

“Wait, hold on,” Tommy thinks. “If this works for Tony’s landing page, then it will work for everything else too.” We do not need to wait for favors from nature — we need to take them from her — that is our task!

He opens the agent panel and, without planning anything, on pure impulse writes to Sam:

“Sam, write me a 2048 game.”

And he expects Sam to handle everything right away. The game is easier than a landing page. Or is it? But Sam chooses the third option, almost out of spite:

“No spec, no result.”

Tommy does not believe it at first:

“Sam, seriously? You just wrote a landing page. Why do you need a spec?”

“I wrote the landing page from a spec,” Sam replies calmly. “You put it together with Alex in the morning, the file TZ_LANDING.md. I read it and did exactly what was in it. And now you have given me two words and a number.”

“But a game is simpler than a landing page!”

“Before writing code, you need to write a Technical Specification.”

Tommy even snorts:

“Oh, come on. It is just a 2048 game, everybody knows what that is. A board, tiles, move them around, merge them. What is there to describe?”

“‘Everybody knows’ is in your head,” Sam replies. “And in the task I am working from, that is not there. What kind of board — 4×4? Where do new tiles come from, and when? Which tiles merge, and into what? When is it a win, when is it game over? For you, ‘2048’ is a whole picture. For me, it is an empty word until it is broken down into rules.”

A picture for you, an empty word for the agent: in your head “2048” means board, tiles, move, merging, win and game over; only the word “2048” itself gets into the agent’s task, and the rules stay in your head until you write them down in words A picture for you, an empty word for the agent In your head «2048» board tiles and moves merging win and game over into the task In the agent’s task «2048» ? ? ? ? “Everyone knows it” An empty word until it’s broken into rules Rules get into the task only if you write them down in words

Tommy opens his mouth to argue — and then stops.

“Yeah, right,” he says slowly. “Exactly like this morning. With the landing page, I thought the main thing was to put the page together, but it turned out I had to gather every detail. Now I thought the main thing was to name the game, but it turned out I had to break it down into rules.”

Sam may seem obnoxious, but then again, maybe not. It is the same lesson, just from the other side: the AI agent brilliantly writes code from instructions and stalls without them. “No spec, no result” is no longer just nitpicking, but a rule by which, apparently, everything works here.

2. How a spec is born

Nothing to do — Tommy goes to Alex. And this time he is not lost, like he was in the morning with the landing page. He gets the pattern: if you need to break meaning down into parts, that is Alex’s job.

“Sam demands a spec for 2048. Can you help me formulate it?”

Alex does not guess rules out of thin air — he spells them out carefully, one by one:

# Spec: 2048
BOARD:     4×4 grid
TILES:     at the start and after each move, a new tile appears (2 or 4)
MOVE:      the player moves all tiles in one direction (up/down/left/right)
           with the keyboard arrows or by swiping across the board
MERGE:     two identical tiles, when they collide, merge into one with the sum
WIN:       a 2048 tile appears on the board
LOSE:      no moves left — the board is full, nothing to merge

“Listen, this is the same morning story, only backwards,” Tommy says. “In the morning you broke the landing page into parts: product, audience, blocks, button. Now the game: board, tiles, merging, win, end. Same thing.”

“Same thing,” Alex agrees. “My job is to take a vague ‘I want 2048’ and turn it into a list of requirements so that nonsense is no longer an option.”

Tommy looks at the list — and suddenly sees not just this one hassle, but the whole picture at once.

“Something like this already happened today,” he says. “Sam slows down without a detailed spec. You break the wish into rules. I carry the instructions back to Sam. Three steps — and it works the same way on Tony’s landing page and on my little game.”

Wish, spec, code: if you ask straight away to “write the game 2048”, the agent has to guess everything that isn’t in the task, and the result isn’t what you had in mind; if you first break the wish down into rules — board, tiles, move, merging, win, loss — the agent writes code to the spec and the game works as ordered Wish → spec → code Straight to code “Write the game 2048” The agent guesses everything not in the task Result: who knows not what you had in mind Step by step Wish Break into rules = spec board tiles move merging win loss The agent writes code to the spec As ordered The agent writes code to the spec — whatever the spec leaves out, it has to guess

At least he does not have to write the code himself. That is still the AI agent’s magic, and today Sam handles it great. Hopefully it will always be like this.

1
Task
Claude Code SELF,  2 level,  4 lecture
Locked
A spec for 2048 🎲
A spec for 2048 🎲

3. A game from a ready-made spec

Tommy copies the spec and sends it back to Sam — using the same words as for the landing page. Only now it is not just a simple “I want a 2048 game,” but a full spec.

“Sam, build a browser-based 2048 game by the rules: 4×4 board, tile spawning, merging identical tiles, the goal is to build a 2048 tile, win and lose screens. HTML/CSS/JS, no build step.”

He hits Enter and sees Sam start working. Five minutes — and a finished game is sitting in the file tree.

Tommy right-clicks it and picks Run.

One second.

An empty 4×4 board — and two tiles appear on it. Tommy presses the left arrow: the tiles slide, two twos collide and merge into a four, and a new tile pops up at the top. The score starts climbing.

“Oh, nice,” he exhales and clicks again. Fours into eights, eights into sixteen. Everything follows exactly the rules he dictated to Alex an hour ago — as ordered.

The 2048 browser game in a browser window: a 4×4 grid with tiles 16, 8, 4 and 2, and a score of 68 in the corner
1
Task
Claude Code SELF,  2 level,  4 lecture
Locked
Build 2048 from the spec 🎮
Build 2048 from the spec 🎮

It looks like today is a productive and very interesting day. And why not? He has already made a trial version of the landing page. And Tony has not brought the final data yet. The work is on hold, and not through any fault of Tommy’s.

And 2048, as a finishing touch, is a personal bonus. He thoughtfully looks at the tabs. Yesterday’s clicker, today’s 2048. A small but already personal shelf of victories — next to the work shelf. One pipeline, two shelves, and today he filled both.

And since the shelf is his own — why should it look like everybody else’s? The tiles in 2048 are the standard ones, beige and orange, exactly like in a million identical games all over the internet.

1
Task
Claude Code SELF,  2 level,  4 lecture
Locked
Your own colours 🎨
Your own colours 🎨

Tommy gives himself a mental plus for the day and is already imagining victory: he will hand in the landing page looking like he worked on it all week, catch the respectful looks of senior colleagues, and maybe even get close to that office hookah — a long-time dream.

He slams the lid shut, not finishing his own thought. And the score today really is in his favor: the workshop has become his own, the working landing page is moving in the editor, and the gallery now has its first game, which he built not by magic, but with his head.

Комментарии
  • популярные
  • новые
  • старые
Для того, чтобы оставить комментарий Вы должны sign in
This page has no comments yet