Datang Mechanical Era

Chapter 122 Puzzle: Infinite Chessboard

Bai Tianyang turned around and cursed: "Damn, why didn't you tell me earlier!"

Lu Zhihao said calmly: "I just remembered it."

Bai Tianyang secretly said: Shit! You kid is clearly using me as a guinea pig to see how powerful this trap set up by Fang Hao is!

He swam back to the shore and saw that "Mingfang Tower" had withdrawn more than 20 meters out of thin air. The width of the lake, which was originally only 10 meters wide, suddenly became 30 meters wide.

And the "Li Chun Bridge" has also disappeared.

And at this time, Bai Yang discovered that many thin lines appeared on the lake, horizontal and vertical, and the distance between them was completely equal.

It's like a Go board is placed on the huge lake.

Bai Tianyang turned his head and glanced at Lu Zhihao, pointed at the lake and said, "What exactly is the mechanism set up by Fang Hao?"

Lu Zhihao said: "Just go to the 'Mo Zhai Pavilion' and you will know."

"Mo Zhai Pavilion" is right next to "Mingfang Tower". It is a square ancient pavilion with a pointed roof located on a rockery. It is about 12 meters above the ground. From there, you can overlook the entire lake.

As soon as he boarded the "Mo Zhai Pavilion", Bai Tianyang could see more clearly that at this time, the entire lake in front of the "Mingfang Tower" was completely covered by a chessboard-shaped grid.

Moreover, this is a Go board with a starting point and no end point.

In other words, starting from the lower left corner, two rays are shot out, extending infinitely upward and to the right, and another ray is shot out to the right or upward at intervals to form a chessboard.

On this "chessboard", at the intersection of horizontal and vertical lines, there are blossoming lotus flowers.

These lotus flowers were originally scattered in the lake, but now they are all located at the intersection points.

In addition, you can also see a crane moving in the lake - sometimes landing on the lotus, sometimes flying across a section of the lake. But no matter how it moves, it always follows the horizontal and vertical lines on the "chessboard" and never escapes.

When Bai Tianyang was still wondering, Lu Zhihao patted him on the shoulder and pointed him to look at the support pillars of the "Mo Zhai Pavilion".

On the red support pillar, one or four lines of text appeared.

"If you want to enter the 'Mingfang Building', please solve this question first:

"On a Go board with a starting point and no end point, there are a bunch of chess pieces (lotus flowers). The number of chess pieces in each column varies.

"Now there is a small robot (crane) that can move up and down along horizontal and vertical lines, pick up a chess piece at the intersection where there are chess pieces, and move it to a place where there are no chess pieces - please design an algorithm to control the robot. So that the final order is based on the number of chess pieces in each column, with the column with the fewest chess pieces on the left and the column with the most chess pieces on the right.

"Click here to start entering program code."

Bai Tianyang looked at Lu Zhihao and frowned: "The robot will pick up these chess pieces here, take a few steps, start stacking the chess pieces from the far right, and repeat the cycle. Isn't it OK?"

Lu Zhihao said calmly: "Let's try it?" As he said that, he clicked on the location indicated on the pavilion pillar, and a virtual keyboard and virtual screen appeared in front of Bai Yang.

Bai Tianyang really couldn't figure out why Fang Hao asked such a nonsensical algorithm question, but he couldn't care less and started typing on the keyboard.

In less than 10 minutes, a program was written and he clicked "Execute".

In the lake, the crane flew to the lower left corner, which is the starting point of the entire "infinite chessboard", and stopped on the water at that point, motionless.

Bai Tianyang frowned and clicked "Execute" again.

This time, the virtual screen made a harsh beep sound, indicating an error.

"Error! The question does not state that the small robot that carries the chess pieces has a counting function!"

Tian Yang was stunned and broke out in a cold sweat.

yes! That's true. Why didn't I notice it before?

Moreover, it seems that the question left by Fang Hao is far more difficult than he imagined.

"Actually..." At this time, Lu Zhihao said from the side, "I have tried the problem-solving idea you just mentioned before. However, I used another programming language. I thought, maybe you can succeed if you change the language. .”

Bai Tianyang wanted to strangle this guy to death: It turns out you have been watching my jokes.

But at this moment, he didn't have the energy to care about this.

Because, just when the system prompted him that his idea of ​​solving the problem was wrong, "Mingfang Tower" moved back about 10 meters.

"Is it possible... let's go around to the back of Mingfang Tower and swim across the lake there?" Bai Tianyang said.

Lu Zhihao shook his head: "I tried, but it doesn't work. Fang Hao has designed it a long time ago. He wrote the entire physics engine in this world, and made special settings here. You think you have made a lot of progress in the water, but when you look up At first glance, 'Mingfang Tower' is still so far away from you."

"Okay." Bai Tianyang stopped talking and stared at the lake, the lotus flowers and cranes on it.

Lu Zhihao was also beside him, staring at him.

"Hiccup! Quack, quack, quack!"

There was a strange sound in the distance again.

This time it seemed closer.

Bai Tianyang suddenly became upset, frowned and said, "What on earth is that?"

Lu Zhihao shook his head: "I don't know..."

Bai Tianyang said angrily: "You are the King of Bliss now. Is there anything else you don't know about here?"

Lu Zhihao said: "I really don't know. There is a process of understanding the situation for the new king to ascend the throne. Besides, I can only be the King of Bliss for 27 hours at most. All I know now is that this place is exactly the same as East China University of Science and Technology in the real world. , outside the campus wall, that is, outside the boundaries of this area, it is complete chaos..."

"Boundary?" An idea flashed in Bai Tianyang's mind and he said, "You mean 'boundary'?"

Lu Zhihao said "hmm" inexplicably.

"That's right!" Bai Tianyang almost jumped up, "Isn't this question a typical boundary judgment question?"

Lu Zhihao was stunned for a moment, and then suddenly realized: "That's right! Why didn't I think of that!"

boom!

Bai Tianyang knocked hard on the location indicated on the pavilion pillar, and the virtual keyboard and virtual display screen appeared in front of him again.

Bai Tianyang's fingers were flying, and he was writing code frantically on the keyboard, muttering to himself: "First, we must determine the rightmost boundary. Each time, start from the bottom row, walk from left to right, until you reach the empty space. , UU Reading www.uukanshu.net explains that we have reached the boundary...and then...then...go to the far right, and then go up a row...walk from right to left...while picking up the chess pieces...after picking up, from the end Go from the bottom row to the far right, and go up one row... This is an empty space, you can tell it without counting, and then place the chess pieces from right to left... Just repeat the above three steps..."

Fifteen minutes later, the last line of code was entered, and Bai Tianyang fiercely pressed the "execute" button.

Together with Lu Zhihao, he looked toward the lake nervously.

The crane parked at the "starting point" in the lower left corner begins to move.

Completely following the idea of ​​Bai Yang's program, he flew around the Go board and picked up and put down lotus flowers from time to time.

Finally, all the lotus flowers were arranged—three in a row on the far left and twenty-seven in a row on the right.

Problem solving completed!

In an instant, the thin lines that made up the "Go board" suddenly turned into bright star points, floating into the air, and then dissipated.

Under the agitation of ripples, the lotus flowers were scattered again in the lake, and the crane also flew far away.

At the same time, the "Mingfang Tower" that was originally retreated 50 meters away moved closer to the shore, and the sunken "Li Chun Bridge" also rose from the water again.

Bai Tianyang and Lu Zhihao cheered excitedly at the same time.

"Bai! I knew you could do it!" Lu Zhihao shouted, "Facts have proved that bringing you here is the most correct thing I did! I am so wise, as wise as ever!"

As he said that, he hugged Bai Tianyang, and with both arms, he hugged her tighter and tighter, almost suffocating Bai Tianyang.

"I have been thinking about this issue for half an hour! Half an hour! Hahaha!" Lu Zhihao continued to chatter.

Tap the screen to use advanced tools Tip: You can use left and right keyboard keys to browse between chapters.

You'll Also Like