《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 Serial85 Chapters
Black Wing
Raven. In a world of fantasy, where magic and sword reign supreme, a girl is reborn. Not as a hero, a villain, or even a common mob. She was reborn as a dumb bird. Now don’t get me wrong, ravens are one of the smartest animals alive. But imagine going from a fully functional human body...to....this... In this world, ravens are considered harbingers of death. Filthy pests. The incarnation of damned souls. Due to their penchant for mischief, they are shunned and despised by human and non-human races alike. Join Raven in her journey from a naive baby bird that wants to become human again (or at least get some semblance of arms/legs), and grow to live a life worth living, eating delicious food and reading great books. Also known as the Ascension of Amaris, Queen of the Night, Beloved of the Moon. *chapter length will vary from around 1500~2500 words.
8 159 -
In Serial24 Chapters
Game On!
Ichiroku who won a Monolith Capsule in a lottery found himself in a virtual reality that surpassed his imagination. Half-heartedly, he logged into the game and advance without knowing anything... Or that was what he thought...Author Note: Sorry for the bad grammar. I wrote most of the chapter in Japanese and translated it later on to english. There might be some inconsistency with past-present tense. WARNING! Contain Intense Cursing!
8 206 -
In Serial7 Chapters
Blood and Gold
Having failed to manifest any attunements on the Testing day, Elias is disowned and cast out from his clan, the royal clan of the Holstein kingdom. Unwilling to stay down and to accept the clan's view of unattuned individuals having no power, Elias seeks to grasp onto and change his fate. If he can't move mountains with his fist, can't he at least move mountains of gold? Elias would show his clan and the world that even an unattuned individual is worthy of respect, even that given to the strongest. This is his journey. Darius proved his mettle and showed everyone his potential when he attuned to both the aspects of fire, the royal element, and blood. With a fast-track to general all but guaranteed, the only thing he could have hoped for was for his twin, his dearest brother, to join him by his side. Unfortunately, Elias tested as unattuned, the level that was reserved for weaklings that deserved to be cast out and trampled. Or at least, that's what the clan says. If his brother couldn't hit with the strength of a legend, didn't he just have to hit twice as hard to compensate? Darius would show the weaklings around him just what the apex of diligence and talent looked like. This is also his journey. Release rate: I'll be aiming for 1 every 2 weeks, I'll add more chapters if I can Cover art credit: 3DGrab's Imgur Dark Souls album
8 193 -
In Serial6 Chapters
9 Levels of Hell - GameLit
Yesterday, Clint and his girlfriend died in a car accident. Today, he woke up with dozens of other humans in a twisted game devised by Death himself. There are only three rules: 1) If you die, you lose. 2) If you reach the end of the ninth level, you live. 3) You may kill each other, if you like If Clint can reach the end of the game, he can save his girlfriend and himself--that is, if the other players don't kill him first.
8 195 -
In Serial30 Chapters
His Adventure In The Soul World
In this world of the Mok Soul, every creatures have distinct features. People who travels to this world from Earth are called travelers. They have the ability to snatch the distinct features of the local creature. Our MC is one such traveler._-_-_-_-_-_-_-_-_-_-_-_-_ Along the journey, -------- he found friendship and treason. He encountered eternal love and deep hatred. He experienced happy endings and tragedies. - All that make him a mature young man. -------- He found strange creatures. He encountered strange materials. He experienced strange events. He has some abilities the others lack. He lacks some abilities the others have. But he can't stop his adventure no matter what. - All that make him question what existence is?-------- Oh, he is our MC, Cank.
8 134 -
In Serial21 Chapters
JOHNNY X CEREAL (CTC FAN FIC)
As Johnny's eating his favorite cereal (Cinnamon Toast Crunch) he un-knowingly makes a wish and what happens from there can only be described as an ever lasting ecstasy, between a boy and his cereal.Chpt 3:"Wh-what are you doing!.." Johnny asked embarrassed but cautiously."I gotta loosen up a bit more." Chris whispered."No- don't!" Johnny stretched as he felt Chris start to lick his hole. Johnny tried desperately to claw at Chris, attempting to remove his head away from him, but he didn't budge.Now covering his mouth Johnny slowly adjusted to Chris's strong tongue which was now thrusting and flicking around In and around his hole."Mmffmm.." Johnny's moans were now muffled and slurred as he felt himself come closer to climaxation.
8 72
