JavaRush/Courses/Claude Code SELF/The task is harder than the previous ones

The task is harder than the previous ones

Open

Oliver storms into the office around lunchtime, rumpled and gloomy, as if he had not slept. Tommy does not miss a chance to needle him:

“Uncle Oliver, what is wrong with you? Were you coding all night or something?”

“What code?” Oliver waves it off, dropping into a chair. “I was grinding Counter-Strike against the computer. Till four in the morning.”

“And? Did you beat him?”

At the coffee machine, rumpled Oliver with tousled hair and crooked glasses is fuming and waves him off — “don’t even ask” — while Tommy smirks and pours himself coffee from the flask of a chemistry set with a “COFFEE” card.

“You do not beat that one.” Oliver fires up instantly. “He is a cheater, not a player! I set the highest difficulty — and he hits me in the head from the other side of the map, can see through walls where I am sitting before I even peek around the corner. That is not skill. That is cheating: he sees the whole map, while I only see what is in front of me. Take away that peeking — and he would be dumb as a post. As it is, he is a ‘smart computer,’ yeah right.”

He mutters something else under his breath and goes for coffee. Tommy chuckles — grandpa being grandpa — and gets back to his own thing.

And his own thing today is this. Tommy scrolls through the gallery — Snake, 2048, Tetris, ticker, radar — and gets bored. All of it is great, but with all of it you play alone. And then the dream that has been itching at him for a long time comes up again: he wants a real, big game. Online. The kind where people pile in and fight each other, like in normal games, not by himself in a corner.

He goes to Alex with that and blurts out right away:

“I want an online game. A real one. So I can play with friends in a crowd.”

“Whoa, ambitious.” Alex does not shut him down, but he does not just nod along either. “Online is not a page. You need a server to handle everyone at once, networking, rooms, move synchronization between people on different sides of the city. That is too much for you right now; you would burn yourself out. Let us try it another way: between ‘I play alone’ and ‘online for the whole world’ there is a fair stepping stone.”

“Which is?”

“Multiplayer on one computer. Two people sit at one screen and take turns playing against each other. No servers, no network — everything in one window. Learn that, and you will grow into online after that.”

Tommy thinks it over — and lights up. That is a step forward, after all: all his games so far were for one person, and here it is for two, live, opponent against opponent. He does not need fancy graphics right now — this is where to grow, none of his games can do that.

“Good! Only…” He cuts himself off. “Two people at the screen. But who is the second one? Am I supposed to drag Oliver by the ears every time?”

“Now that is where you should think.” Alex says it like a teacher who knows the answer but is nudging him toward it. “Start simpler: let the one across from you be not a human, but a computer.”

“Oh, right!” Tommy is already racing ahead. “We write a computer opponent! It looks at the board, figures out where to move, chooses the best move, answers me, I answer it…”

“Hold on. And who is going to write all that for it?” Alex kills the momentum. “‘Looks, figures out, chooses the best move’ — that is the hardest part. The player’s brain. Somebody has to program how the computer thinks: how to evaluate the position, how to search through moves, how to pick the strongest one. That is a separate big job, weeks of work.”

“Well, Sam will write it.” Tommy shrugs. “He writes everything.”

“He will write it if you spell out in detail exactly how to think,” Alex counters. “Sam will not assemble a player’s brain out of thin air. You will have to hand him a full spec: how to evaluate the position, how many moves ahead to calculate, how to choose the strongest one from the options… Do you even know that well enough to write it out?”

Tommy grimaces — it sounds tedious, and more importantly, he really does not know. And then it hits him, so hard that he straightens up:

“Listen! Why am I even writing the computer’s brain if I have an AI agent?! Let it sit on the second side! It already knows how to think — so let it figure out the opponent’s side itself.”

“Now you are talking.” Alex is pleased that it clicked on its own. “The AI agent plays for the second side — and there is no need to write any logic by hand, it will figure out on its own where to move. All that is left is to decide what to play.”

Who will write the opponent’s “brain”. A second player is needed at the board — two paths. Path 1: the agent writes the “brain” in code. First you need a spec: how to evaluate the position, how many moves ahead to calculate, how to choose the strongest one. Nobody can write it — you do not know yourself how a player thinks; a dead end. Even with a ready spec it is weeks of work, and the program will play exactly the way you wrote it out. Path 2: the agent sits down at the board itself. It is shown the game state, figures out on its own where to move, makes a move, you answer — and so on every move. No need to write any logic by hand. The difference: in path 1, thinking for the opponent is up to you; in path 2, the agent itself does the thinking. But for that it needs to see the whole game state Who will write the opponent’s “brain” A second player is needed at the board PATH 1 · the agent writes the “brain” in code PATH 2 · the agent sits down at the board itself First — a spec for the “brain”: · how to evaluate the position · how many moves ahead to calculate · how to choose the strongest from the options “Do you even know that well enough to write it out?” Dead end: nobody can write the spec you do not know yourself how a player thinks And even if there is a spec — weeks of work, and the program plays exactly as you wrote it out The agent is shown the game state It figures out on its own where to move Move made — now you answer and so on every move · no logic to write by hand In path 1, thinking for the opponent is up to you. In path 2, the thinking is done by the agent itself. The price of path 2: the agent needs to see the whole game state — and that is the next question

Tommy is already ready to run to Sam, but something from the morning keeps sticking in his head:

“Listen, this morning Uncle Oliver was whining that the computer in his shooter was cheating. Is that really true? Does a strong computer opponent always cheat?”

“Often, yes.” Alex does not brush it off. “The classic game ‘strong computer’ really does often cheat: to play strongly, the easiest thing for it is to peek at what is hidden from the live player. It sees the whole map through walls, knows the cards in your hand. Not because it is smarter — because it is snooping.”

“Then that is annoying.” Tommy figures it out. “You play against that, you try — and it is just a cheater. You do not really learn anything from it.”

“Exactly. And now look where I am going with this.” Alex unfolds the thought. “For us, the opponent will be an AI agent. It is genuinely smart; it has no reason to cheat in order to play well. But one thing ties it to that cheater: in order to move, the agent has to see the game state — read the detailed game map, what is where. And now the question is: what does it get from that ‘vision’?”

“Well… it will see the map. If it is open, I can see it too.” Tommy shrugs.

“Depends on the game. What if the game has fog of war?” Alex presses his point. “Cards in hand in Poker, hidden ships in Battleship. The agent will read everything that exists in the game, down to the last detail — including what is hidden from you. Not out of malice — just because, to make decisions, it gets access to the whole state. And it will end up exactly like that cheater from Oliver’s shooter: seeing what a live player cannot see.”

“So in a game with fog of war, an AI agent will inevitably end up as a cheater.” Tommy gets it. “Even without wanting to.”

“Which means,” Alex says, bringing it to the conclusion, “we need a game where there is nothing to hide at all. Where the whole state is in plain sight, and both of you have the same picture in front of you. Then ‘the agent sees everything’ is not cheating: it sees exactly the same thing you do.”

“Which game is that?” Tommy runs through them aloud. “Battleship — the ships are hidden there, so no. Cards — the hand is hidden, too. Tic-tac-toe? Kindergarten…”

“How about chess?”

Tommy freezes. Exactly. The whole board is visible, both players see the same picture, there is nothing to hide — it could not be fairer. And not some snake game: it is a serious, grown-up game, not embarrassing to show off.

“Chess,” he repeats, savoring it. “I play White, the AI agent plays Black. Cool!”

The phone vibrates. In the chat with Tom2036 — a fresh image. No explanation, as usual.

A driverless buggy speeds down a desert highway: the wheel turns by itself, a brick sits on the gas pedal, and the passenger in sunglasses lounges with his hands behind his head and his feet up on the side.

“Oh, that fits.” Tommy snorts. The car drives itself, the driver is resting — exactly what he wants today: to put someone behind the wheel instead of himself. He does not get hung up on the “almost”; who knows what that guy from the future is always doing in those captions. He swipes the image away and heads to Alex — to put it together.

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