Genius Girlfriend

Chapter 7: Floyd-Dijkstra path

Views:

After Lin Zhixia finished speaking, she pulled Jiang Yubai and ran forward.

The castles and fortresses set as bases by Group A and Group B are all located at high places, and the criss-crossing tunnels are mostly located at low places.

Under Nie Tianqing's interference, the bubble ball rolled into different tunnels. Nie Tianqing shuttled through the tunnels without any scruples, kicking the ball everywhere.

Lin Zhixia looked at the overall situation and concluded: "If we regard this game as a graph theory problem, each node of the tunnel is a vertex of the graph. We have a total of thirty-seven vertices. This graph has been imprinted in my mind. Some tunnels are transparent, and some are not. This involves partially observable Markov decisions..."

"Lin Zhixia!" Jiang Yubai said righteously, "You don't have to explain to me! I believe you!"

Lin Zhixia dragged him into a tunnel: "You don't understand, so you don't want to listen? Then you can only follow me and listen to my instructions."

For the victory of the entire team, Jiang Yubai forgave Lin Zhixia's provocation.

They ran to the node of the tunnel and quickly picked up seven balls.

While running around, Lin Zhixia ran into Dong Sunqi from her group. Dong Sunqi shouted, "Follow me, there is a shortest way here! Only by taking the shortest way can we get back faster!"

"No!" Lin Zhixia said, "Always choosing the shortest path is not necessarily the best solution for the whole world!"

Dong Sunqi was horrified: "What the hell are you talking about!"

Lin Zhixia responded: "Think about the three sides of a triangle! Side a and side b are shorter than side c, so their sum must exceed the length of side c. It's such a simple truth! Why don't you understand it when it's put into graph theory!"

Dong Sunqi's body was shocked: "It seems to make sense! You talk too much, I'll listen to you!"

So, Dong Sunqi and Jiang Yubai both became Lin Zhixia's followers.

In just a few minutes, they collected twelve bubbles. However, something unexpected happened, and three people from the enemy team came straight towards them.

Ding Yan ran wildly while shouting, "Gan Shuli, Nie Tianqing! Let's go, rob Jiang Yubai! They have so many balls! They are so good at picking them up! We don't have to pick up the balls ourselves, we can just follow them and rob them!"

Jiang Yubai was not panicked at all. He stood there calmly and looked at Lin Zhixia calmly: "You must have a way."

Lin Zhixia's eyes turned and she said, "I can't help it. Let's run! Help, help! Run!"

"What?" Jiang Yubai was panicked and hurriedly followed Lin Zhixia to escape.

Lin Zhixia laughed and jumped, her ponytail untied. She, Jiang Yubai, and Dong Sunqi successively got on the slide and rushed into the trampoline.

Lin Zhixia was running in the front holding four balls. Her figure flashed quickly and disappeared in the intricate tunnel.

Jiang Yubai and Dong Sunqi were both at a loss, just like the French army that lost the Maginot Line during World War II. Even though they still had mobile forces, they didn't know how to continue fighting.

"You go through the blue tunnel! Then the red tunnel!" Lin Zhixia's voice came from above, "Hurry up and put the bubble balls into the center area of our group!"

Jiang Yubai immediately asked: "Where are you going?"

Lin Zhixia said: "I'm going to look for the people in their group B."

"No!" Jiang Yubai stopped him, "Lin Zhixia, don't go!"

Lin Zhixia said goodbye to him: "I'm leaving now! I don't know if I can come back!"

Jiang Yubai stepped onto the entrance of the blue tunnel: "Where are you? I'll go save you!"

Lin Zhixia was determined to leave: "No need, I can't be a coward! You stay at home and protect the bubble balls well, protect every bubble ball! That is our last hope for victory!"

Dong Sunqi was also heartbroken: "Lin Zhixia, please leave! We will always remember you!"

"What did you say?" Jiang Yubai began to criticize Dong Sunqi, "We are a team, how can you abandon your companions? Don't you have something you want to protect?"

Dong Sunqi answered firmly: "Yes! I want to protect the bubble ball! Lin Zhixia asked us to protect the bubble ball, you go to the center area of our group A!"

The two of them headed straight for the central area of Group A's base.

In the suspended tunnel, Nie Tianqing suddenly said, "There are footsteps. Lin Zhixia is here."

The three members of Nie Tianqing's team did not run away. They stood still and discussed countermeasures.

Ding Yan revealed: "Lin Zhixia's nickname in our class is freak. She is very smart, you have to be careful."

"She's only nine years old," Nie Tianqing said. "No matter how smart she is, how smart can she be?"

Ding Yan's face changed slightly: "It only takes her three seconds to recite!"

Nie Tianqing didn't believe it.

Ding Yan angrily said: "Really! I lied to you and I am a puppy!"

Gan Shuli also said: "Really, she is so smart."

"Don't encourage others and destroy your own prestige," Nie Tianqing taught them like an elder brother, "The opponent is not that scary. There are three of us. If we play rock-paper-scissors against her, can't we beat her? Each of us has a 50% chance of winning!"

"That makes sense!" The person who responded was Lin Zhixia.

Lin Zhixia followed Nie Tianqing's meaning and said to them: "Fifty percent cubed equals 0.125, so my chance of winning is only 0.125."

Nie Tianqing asked: "Why is it 0.125?"

Lin Zhixia tilted her head: "I must beat every one of you. The probability of winning the first time is 0.5, the second time is 0.25, the third time is 0.125... Isn't that what you said? You assume that the probability of winning in a two-on-two match is 0.5..."

Nie Tianqing frowned. "But, Lin Zhixia, when you play rock-paper-scissors with us, as long as you lose once, you can't continue. Why do you still use 0.5 to the power to calculate the probability?"

"Think of it this way," Lin Zhixia explained patiently, "When I play with the three of you, there are four possible outcomes. The first outcome is that I lose the first game, with a probability of 0.5. The second outcome is that I lose the second game, with a probability of 0.25. The third outcome is that I lose the third game, with a probability of 0.125. The fourth outcome is that I win the third game, with a probability of 0.125. The sum of these probability events is exactly equal to 1. Can you calculate it? The prerequisite for me to enter the second and third games is that I won the previous game. However, you have to know that winning the previous game is not the final state."

Nie Tianqing suddenly realized something. He made a fist with his right hand and hammered it into the palm of his left hand: "I figured it out."

He turned to look at his two companions: "Are you happy? We have a 0.875 chance of winning!"

Ding Yan trembled a little: "Nie Tianqing, she said so much, and you still think you can win? She must be lying to you. I don't believe it."

Nie Tianqing bypassed Ding Yan. He walked towards Lin Zhixia and said with a fighting spirit: "Let's start, Lin Zhixia, rock-blade-scissors-paper."

Lin Zhixia is happy.

Then, they both attacked at the same time - Nie Tianqing used stone and Lin Zhixia used paper.

Nie Tianqing was shocked and froze in place.

Lin Zhixia clapped her hands and jumped in front of Ding Yan.

Ding Yan was terrified. He gritted his teeth and showed his scissors, while Lin Zhixia showed his rock. Ding Yan had an expression of "I knew it a long time ago" on his face, and began to count down the three minutes of freezing.

The only person left in Ding Yan's group is Gan Shuli.

The hope of the entire group rests on Gan Shuli.

Gan Shuli said incoherently: "I... rock-paper-scissors..."

"Gan Shuli," Lin Zhixia patted her shoulder, "Don't be nervous."

The tunnel node is a closed space. There is a glass window on each side, with an exhaust vent on the top. Gan Shuli looked out and could see the trampoline, zipline, and chandelier. She made up her mind and faced Lin Zhixia: "Lin Zhixia! Rock, paper, scissors!"

After she finished speaking, she spread out her five fingers and made a "cloth" shape.

Lin Zhixia seemed to have made her move earlier than Gan Shuli. She had already made a scissors gesture before Gan Shuli could react.

Gan Shuli was surprised: "You... won again."

Lin Zhixia smiled and said, "Oh, it all depends on luck."

Lin Zhixia was thinking that it was all luck that made her different from everyone else. She could predict the behavior of each of her classmates by observing various details.

Gan Shuli applauded her: "You are so lucky."

"I told you!" Ding Yan warned Nie Tianqing, "I knew it a long time ago! We can't beat her!"

Nie Tianqing brought up the past: "You knew this a long time ago, so why did you bring us here to rob Lin Zhixia's group?"

Ding Yan was speechless. He just couldn't stand Jiang Yubai's happy look as he followed Lin Zhixia to pick up the balls easily. In just a few minutes, he picked up a bunch of balls! Why? Why didn't Jiang Yubai use his brain? He didn't want to use his brain either!

Poor three people in their group, all of them were frozen in place.

Lin Zhixia had already run away.

On the way back to the base, Lin Zhixia was still picking up balls. She was so happy that her long hair was loose and draped over her shoulders, like a little lunatic. But she didn't care at all. She picked up four balls and rushed into a tunnel, just in time to bump into Jiang Yubai.

Lin Zhixia fell down on the spot.

Jiang Yubai knelt on the ground and supported her with both hands.

She said sadly: "The four bubble balls have all rolled away, go pick them up quickly..."

Jiang Yubai only asked her: "I'm sorry, did I hurt you? I have a doctor at home."

Lin Zhixia shook her head: "No." Then she asked: "Why are you saying sorry to me? I bumped into you, too. You didn't mean to do it. Forces act on each other."

A red hair tie was hanging at the end of Lin Zhixia's hair. Jiang Yubai gently took off her hair tie and said, "Tie your hair up. In the tunnel, your hair cannot block your eyes. You must see the route clearly."

Lin Zhixia had already picked up three bubble balls. She sat on the ground with her back to Jiang Yubai: "Help me tie my hair! Hurry up!"

Jiang Yubai was startled: "I... I don't know how to tie my hair."

Lin Zhixia immediately threw the bubble ball into his arms and snatched the red hair tie from his hand. She tied up her long hair while muttering, "It's very simple to tie your hair."

Jiang Yubai said: "I haven't learned it."

Lin Zhixia told him: "There are many things that are so simple that you don't need to learn them. You can master them just by taking a look."

Dong Sunqi in the distance let out an earth-shattering roar: "Jiang Yubai! Lin Zhixia! Where are you!"

"Let's go!" Lin Zhixia pulled Jiang Yubai up, "Let's continue picking up the balls!"

Jiang Yubai asked her: "Are you still using the shortest path algorithm?"

Lin Zhixia looked back at him and ran forward with him: "Of course! I have a Floyd algorithm matrix in my head! All tunnel nodes are vertices of the graph. When the matrix doesn't work, I build a Dijkstra tree, and this tree also grows in my head. In fact, to put it bluntly, it is a fusion of greedy, exhaustive and pruning algorithms. It's as simple as tying your hair. You don't need to think. You can do it at a glance! I'll take you the fastest way! Let's go home together!"

Jiang Yubai couldn't help but admire her. Hearing her say "I'll take you the fastest way, and we'll go home together", Jiang Yubai was very happy. This time, their group A will definitely win!

The road in the tunnel was rough, and Jiang Yubai and Lin Zhixia each carried four balls. Jiang Yubai spied on the enemy's movements and said in surprise, "They are not chasing us anymore."

Lin Zhixia laughed loudly: "They will soon go to the center of our group A base to rob Dong Sunqi. We must run back to the center of group A's base as soon as possible before they attack!"

"What!" Jiang Yubai accused, "They are so sinister!"

Lin Zhixia comforted him: "Don't be afraid! I will protect you!"

She jumped onto a pipe.

Jiang Yubai put all four balls in his arms into the pipe. Then, he held the ring with one hand, stood at the starting point of the zipline track, turned around and said to Lin Zhixia: "You go back to the base first! I saw two balls on the trampoline!"

Lin Zhixia warned him: "Be careful, go quickly and come back quickly!"

Jiang Yubai flew to the ground like a gust of wind. He leaped and landed on the trampoline with a very steady step. His landing posture was also very skillful. He used a roll on the spot to reduce the impact, and the trampoline didn't even shake up and down.

He picked up the precious bubble ball and looked up at Lin Zhixia on the castle.

Lin Zhixia stood by the window of the castle, stretched out a hand and waved at him.

Jiang Yubai remembered the fairy tale books he had read—the princess was always standing on the castle, waiting for the prince to kill all the demons, waiting for the prince to rescue her.

But the princess in front of him was different.

The princess in front of him was more like a prince who had overcome all obstacles than he was.

The stories in the fairy tales were not written correctly. He had seen with his own eyes that the princess could be invincible and ride the wind and waves.