073 Science Fiction
After accompanying Tang Lingfei and them to celebrate their birthdays, the next morning, Xu Zhe still had to go to school to exercise his thinking.
But unlike the previous visits, today he had a laptop in his bag.
Since I told Shen Lan before that I wanted to teach her programming, then of course it is best to take a computer to teach on the spot. He didn't know if this senior sister was really that interested in programming now, but he planned to teach it well. For this, he even prepared a vivid case.
If he can teach, he may not only gain a bright helper in the future, but also have a friend who can talk more about common topics.
Although in the past six months since his rebirth, his interpersonal relationships have been much stronger than in his previous life, and he has had a lot of interesting experiences, but if you want to say that his biggest strength and hobby, it is programming. It's a pity that no one around me, whether it's students of the same age or parents and teachers, can talk about this kind of thing. This makes Xu Zhe sometimes feel a little excited.
So after today's Olympiad lesson ended, Xu Zhe picked up his schoolbag and put it on Shen Lan's desk.
Shen Lan saw that the schoolbag seemed to be heavy: "This is ......"
Xu Zhe smiled slightly: "Remember what I want to teach you, right?" ”
Shen Lan was shocked: "You brought it to school?" ”
Xu Zhe: "I don't think I need to go to the billiard hall today, it's in this classroom, just right." ”
"What are you doing?"
Xu Zhe and Shen Lan turned their heads and saw the classmate named Wei Junkun.
In the silent gaze of the two people, Wei Junkun felt a trace of pressure, as if he had broken into an occasion that he shouldn't have come to and became very redundant......
"Aren't you hungry? I'm going to eat quickly. ”
Wei Junkun hurriedly retreated.
At this time, the other students in the competition group also packed up their things and left, leaving only Xu Zhe and Shen Lan in the classroom.
Xu Zhe: "Are you hungry?" Why don't I pack a cold skin and eat it? ”
Shen Lan got up with a smile: "I'll go buy cool skin, you just wait for me here." ”
————
The cold skin that Shen Lan packed back was delicious, but Xu Zhe encountered a small problem.
He wanted to give Liangpi's money to Shen Lan, but he was refused.
Liangpi is four yuan, and there is a bottle of orange juice of three yuan each, it stands to reason that he should give him seven yuan, but Shen Lan didn't accept it at all.
"Just treat me as a treat, Teacher Xu, please teach me a good lesson."
Xu Zhe: "...... Okay, then I'll show you a case now. To learn programming, I think it's better to start with vivid cases than to chew on textbooks. ”
With that, he took out the notebook in his schoolbag, put it on his senior sister's desk, and turned it on. Then he took out the charging cable and plugged it into the socket on the wall at the front of the classroom. After making sure that there was electricity in the outlet, he was completely relieved.
Shen Lan sat there with one hand on her cheek, looked at him, and asked with a smile, "Do you want to use the outsourced work you did as a teaching case?" ”
Xu Zhe: "No, those are still too boring. So last night I wrote a game out. ”
Shen Lan couldn't help but be stunned: "The game you wrote yourself?" ”
Xu Zhe: "Yes, it's very simple, a puzzle match-3 mini-game. ”
These words made Shen Lan really confused. She knows that she also has a bit of a concept of puzzle games, but what is match-3?
But when Xu Zhe clicked on the game and let her play, she quickly understood.
The rules of this game are very simple. On the game screen, there are tons of small squares stacked on top of each other, and each time you click on a small square, it will move into a long box. There are seven slots in the box, and you can eliminate them by collecting three of the same small squares.
Bananas, corn, cabbage, turnips...... Different kinds of small squares, distinguished by simple icons.
After Shen Lan played for a while, she couldn't help but exclaim, "You made this alone?!" ”
Xu Zhe: "That's right. ”
Shen Lan: "It's a bit like Lianliankan, but it's different...... Did you name it? ”
"A sheep?" Xu Zhe smiled, "Actually, the name doesn't matter, this game is not difficult to make at all, it is very simple." ”
Shen Lan: "Have you ever thought about posting it on the Internet?" ”
Xu Zhe: "I've thought about it, but it's not suitable now." Pingguo Store now only has a buyout system, and cannot do free in-app purchases. If it is posted directly on the Internet like a normal mini-game, it will appear in places like 4399 without waiting for it to make me money. It's too easy for people to pirate. ”
Shen Lan blinked, realizing that the information he knew couldn't be compared to Xu Zhe at all, so he could only keep his mouth shut.
And Xu Zhe tried to inspire her, saying: "The logic of this game is very simple. Do you want to try to think about how to describe it in a purely logical way? ”
Shen Lan pondered for a moment and shook her head helplessly: "I really don't know anything about programming. ”
Xu Zhe: "It's okay, let's ignore the details and talk about the main logic." First, let the computer create random blocks and arrange them randomly. Arrange with 3D coordinates, although it will only show 2 dimensions. Then, the system checks each block to see if there are any other blocks in front of it that block it. If it is blocked, the block will be grayed out and cannot be clicked; If it's not blocked, it keeps its original color and can be clicked. ”
Shen Lan followed his train of thought and subconsciously asked, "Then what?" ”
Xu Zhe spread his hands: "Then it's OK." ”
Shen Lan blinked her eyes and gradually grew her mouth: "It's that simple? Impossible! ”
Xu Zhe smiled: "Of course, the actual operation has to take care of many details. But the logic of creating a game is as simple as that. And the way the player operates, it's just as easy to implement. After the player clicks on the block, the number of clicks is added to the stack, and the same three are eliminated, and the total number reaches seven, and the game is over. ”
Shen Lan also followed his explanation, stared at the screen and pondered for a while, and suddenly realized a problem in this set of logic.
"No, then you can't guarantee that this game has a solution! You might find that the blocks you need are buried underneath, and it's impossible to play down. ”
Hearing her say this, the corners of Xu Zhe's mouth suddenly opened, and he smiled very happily.
"Hahahaha," Xu Zhe laughed, "this game may not be able to be cleared in the first place. No, it should be said that it was originally a matter of luck and a lot of attempts to clear the level. ”
Shen Lan was a little unhappy: "What's the point of spending half a day playing this?" ”
Xu Zhe: "Being able to attract people's time and energy is the meaning of this kind of thing. Or you could say that the concept of meaning does not exist in the first place...... Okay, I'm just writing a minimalist game case to give you an idea of how to program. ”
Shen Lan said thoughtfully: "I kind of understand. It would be great if the computer teacher also taught like you......"
————