《Programming Wizards!》Gyroplane
Advertisement
“A friend of mine returned from an expedition yesterday.” The students attentively listened, for stories from beyond Rorohiko were rare. “They flew over a forest in a gyroplane.” He looked around. “Does anyone know what a gyroplane is?” He pointed to a student with his hand raised.
“A vehicle capable of flying in any direction or hovering in place using its propellers.”
“Yes, what is your name?”
“Roy.”
“Roy, do you know how we can keep its propellers turning?”
He thought for a moment, then shrugged. “I’m not sure what you mean.”
“How can we run code repeatedly?”
He thought some more. “Wouldn’t you have to keep executing the code again and again?”
“Yes, do you know how to write that in code?”
“No, unless you’re about to teach us how to do it at runtime.”
Vick smiled, he knew this class was different. “Yes. Today, you will learn how.”
while (true) { Console.WriteLine(“Looped!”); }
“Above me,” he pointed to the screen, “is a ‘while loop.’” He executed the code. ‘Looped!’ it said. Then, on the line under it: ‘Looped!’ Then, on the line under that: ‘Looped!’ Then, over and over and over. “It will continue to execute as long as its condition is true. What we’ve created is an infinite loop.”
int i = 0; while (i < 5) { i = i + 1; Console.WriteLine(“Loop #” + i); }
He ran the code, and after displaying five lines, ‘Loop #1,’ ‘Loop #2…’ the program completed its execution. “The condition is checked before the execution of the loop. The loop is only executed if the condition is true. What we’ve made is essentially a ‘for loop.’”
Advertisement
for (int i = 0; i < 5; i = i + 1) { Console.WriteLine(“Loop #” + (i + 1)); }
He ran the code again, and it displayed the same five lines. “Instead of declaring an integer beforehand, and incrementing it in the loop, we can declare it, condition it, and increment it in a single line. That’s the power of a for loop. Note how we add one to the variable ‘i’ before concatenating it. This is because, in a for loop, the increment occurs after the loop’s execution. Whereas, before we incremented ‘i’ at the start of the loop.”
do { Console.WriteLine(“Looped!”); } while (true);
“The last loop is similar to a while loop,” he raised a finger, “with one important distinction. It executes at least once. Meaning, it executes once, then evaluates the condition to figure out if it should execute again. This is a ‘do while loop.’ Or simply, ‘do loop.’” He looked over the class, looking each student in the eye. “If you are to become apprentices, you must be wary with your use of loops.” His voice was uncomfortably firm, almost grim. “We will entrust you with precious resources, if you accidentally make an infinite loop where resources are expunged, there will be grave consequences.” He diverted his attention back to the computer. “Now, what does this have to do with gyroplanes? Well, their propellers need constant energy to spin.”
bool isOn = true; while (isOn) { Console.WriteLine(“Spin!”); }
‘Spin!’ said the screen over and over. “Yes, it is an infinite loop. However, another process would be occurring between each loop. That process would detect if a button was pressed which toggles the boolean. When that button is pressed, the loop will evaluate its condition as false, stopping it.”
Advertisement
for (float speed = 1f; speed < 20f; speed += 2f) { Console.WriteLine(“Spinning at speed: ” + speed); }
“The ‘f’ letter at the end of the numbers is to indicate it as a float in this language, not to be confused for an integer. The speed of the propeller can be controlled with each execution of the loop. Begins at one, only executes if it’s below twenty, increments by two every loop.” He walked closer to the class and stood taller. “Because of our great wizards, we were able to construct hardware that made it impossible for a propeller to spin too fast. So, even if we made an error where the speed became an enormous number, the propeller would simply rotate at its max speed dictated by its hardware. Just as integers and floats have a min and max range, so does the speed of a propeller. Zero being its min, and around four-hundred being its max.”
“What does ‘speed += 2f’ mean?” asked Willard.
“That’s shorthand for incrementing by two, and then setting that value to the variable.”
After class, the three huddled to converse. “Hey,” said Willard. “Does anyone know what a forest is? I heard Mister Vick use that word.”
“I’m not sure,” said Andrew, and Gus shrugged.
“It’s a massive cluster of trees,” said Roy, from down the hall, and walked towards them.
“Like, five or so?” asked Willard.
“No,” said Roy and stretched his arms to his sides. “A thousand kilometers, maybe more.”
Everyones’ jaw dropped. “What?” said Gus.
“A thousand kilometers? That’s impressive,” said Andrew.
Advertisement
-
In Serial2708 Chapters
Forty Millenniums of Cultivation
“Even if this universe is truly nothing more than a brutal, bloody, shadowy forest, we Cultivators will burn all that we have just to give off a single weak flickering spark in the darkness! No matter how weak each spark is, how short-lived, how small… As long as the sparks flow unabated, then one day one of those sparks will light some tinder, and that tinder shall light some fallen branches, and those branches shall set ablaze each and every last tree of the forest! In the end, even the smallest sparks will eventually set the shadowy forest ablaze, and illuminate the whole world!”
8 176 -
In Serial13 Chapters
The Roleplayer
Riley Petesgeralt is your every-day suburban boy by day, but an avid gamer at night, soaring to the top 50 players in an MMORPG called World of Legends.However, after a spiritual encounter, his life turned upside down. Both his worlds has collide, and now, his life is a game?Follow Riley as he embarks on an adventure in adapting his new, unique game-like abilities in his every day life, where he discovers "life" isn't as normal as it seems.
8 197 -
In Serial30 Chapters
King: The Silver King's Echo
Credits to Hanstrondheim for the cover art and Muddy and Danetello for the Synopsis! Synopsis: What is a King?A King is more than just a generation or a class. They are known as Kings due to the mysterious powers they wield. Their power allows them to destroy armies alone, guide their people to greatness, split mountains with their bare hands, and even kill the strongest monsters.Yet even after all these years, the origin of their powers remains unknown.A once ugly and sickly kid is transported into this world. He’s granted powers beyond his own control. He must quickly grow strong, lest he risks destroying himself as well as the world around him.His ultimate goal? To "live as long as he can". This desire, although simple, will herald his rise as the "Silver King" the world once feared.
8 125 -
In Serial12 Chapters
Making of a Genius [A Progression LitRPG]
What does it take to climb to the top of the academic ladder? Lexus came face to face with his mediocrity the moment he arrived at Cambridge University to study computer science. There was a ceiling that he could not overcome, an intellectual world that was unreachable. But if you give a chicken an eagle's wings, it will fly higher than you could ever imagine. And that was exactly what happened to Lexus: with the help of a system, he could make it big. Schedule:1 chapter per week (every Friday evening at 5:30pm GMT). The weekly schedule is to allow time for research and factual accuracy where required. Author's Note: The story is about a computer science student at university, gradually improving and embarking on the path to become a world-renowned genius-level expert with the help of a system. There'll be a lot of studying and academics, but imagine being the best in your year. Easily. At that point, academics stops being stressful and starts being fun, doesn't it? The initial chapters are heavy on mathematical detail, but I don't expect anyone to actually read through them thoroughly. It's fine to skim them or even skip them, but I hope you try to get a sense of the progress being made, and feel happy for Lexus when something 'clicks' inside his brain :) As the story progresses, later chapters will go into less depth into individual questions, though I aim to remain consistent in terms of scientific accuracy/feasibility. Welcome, and I hope you enjoy the story!
8 93 -
In Serial42 Chapters
Solangelo
This is a cute solangelo story after what happens in blood of Olympus. Enjoy!This is completed! (And really old if u hate it I don't blame u I have recent books that are MUCH better)-this was written when I was 11-12. I am much older and have become a much more skilled writer-
8 128 -
In Serial4 Chapters
Natsu's Fairytail Harem
This is a story about how almost EVERY boy in Fairytail is in love with Natsu, what happens when things happen? It's either all or none. None of the art is mine unless I say so, and if not I just edit it. All credit goes to the artist
8 176
