《Programming Wizards!》Numbers! Letters! Strings?!
Advertisement
Four organs floated in the glass containers. “And these,” said the teacher. “Are the four types you will find most commonly.” The organs had a luminous stripe going through their center and numerous flaps either turned to the left or right. “This,” he pointed to the organ with four flaps, “is a boolean.”
‘Boolean,’ wrote the students on their tablets using them as notebooks. Some drew a detailed picture while others drew a diagram.
“This bit turns on,” said the teacher. He pressed a button built onto the side of the container and the highest flap turned from left to right. “If the bit is on, it has a value of true. If the bit is off, it has a value of false.”
“If the flap is to the left,” said the student, “it is off, and if it is to the right, it is on?”
“Yes,” responded the teacher. “A single flap is called a bit.”
‘Bit,’ wrote the students in their notebooks.
“More precisely,” continued the teacher. “A bit is off when it is zero, and on when it is one. For this is zero-zero-zero-one, because three flaps are off, while one is on.” He moved to the center of the four containers. “These,” he said and lifted his arms as if he were presenting them a grandeur. “Are data types,” he finished saying.
‘Data types,’ scribbled onto the notebooks.
“A boolean,” said the teacher, “is either true or false.” He moved to the container next to the boolean. “This is an integer.” The organ had thirty-two bits, twenty-eight more than the last. “An integer holds over four billion val—” he paused to correct himself. “An integer,” he repeated, “has over four billion states.”
The students raised their eyebrows in awe. “Four billion?” one said.
“Two to the power of thirty-two. What is it?”
The students punched the numbers into their tablets which were now functioning as calculators. “Four-billion-two-hundred-ninety-four-million-nine-hundred-sixty-seven-thousand-two-hundred-ninety-six.”
“Exactly,” responded the teacher and a student in the back shivered. “Over four billion states.”
“Does a boolean have sixteen states?” questioned a student.
“Ah!” the teacher burst out in amazement. “Where did you get that number?”
“I calculated two to the power of four. Since a boolean has four bits.”
“Excellent. It would seem so, but that is not the case. A boolean only has two states, either true or false.”
“Would it not only need one bit, then?”
“It would, but technology loves four. Actually, technology loves bytes. Bytes are four bits.”
‘Bytes are four bits,’ wrote the students.
“You’ll commonly find bytes rather than a bit on its own.” The teacher paused for a moment to think if he wanted to complicate it further. “Actually,” he decided to. “A byte can be four or eight.”
‘Bytes are four or eight?’
“It depends on the architecture. We’ve noticed the byte of eight is becoming more common, as the byte of four is fading out. Technology is advancing. And, who knows? Maybe bytes of eight will fade out to be replaced with bytes of sixteen.”
‘Depends on the architecture.’
“Thirty-two bit systems used to use four bits. Sixty-four bit systems use eight bits. In fact, it might even depend on the language you are using. Some compilers, which turn the code into machine code, compile the code to use four bits rather than eight.”
Advertisement
‘Depends on the compiler.’
“Remember what I said during the introduction class?”
The students tried to remember.
“Search!” he yelled and startled the students. “To figure out how your specific language works, you need to search for answers on the internet.” He turned back to the containers. “Although, this is usually not an important distinction,” his voice had a deep resonance as it bounced back off the glass into the ears of the students. “It doesn’t matter if a boolean is four bits or eight bits if you simply want to store a value of true or false.” He looked up at the organ that looked identical to the integer. “This is a float,” he said.
‘Float, thirty-two bits or four bytes.’
“An integer is any whole number.”
‘Integer = whole number’
“Well, ranging from about negative two billion to positive two billion. Whereas, a float is any real number.”
‘Float = real number’
“Within a specific range, of course. An integer can be one, two, five-hundred-twelve. Whereas, a float can be one, two point five, five-hundred-twelve point ninety-two.” He stared at the float with admiration. “I would love to explain to you how the float stores its state, but,” he said with a bitter smile. “That will have to be for another time.” He moved onto the next and last container. “Character,” he said.
‘Character,’ they wrote.
The organ had eight bits, or two bytes in the old system, or one byte in the new system. “This is a character.” He turned to the students. “The words we use to communicate use letters, which are characters. A character does not need to be a letter, it can also be punctuation. Two to the power of eight.”
“Two-hundred-fifty-six,” said a student instantly.
The teacher smiled. “Yes. Two-hundred-fifty-six. A character has that many states.” He sighed. “Although, it can be increased or decreased. For example,” he said and closed his eyes. “Let’s imagine eight bits or one byte.”
The students followed.
“A character is one byte.” He raised a finger.
They raised a finger.
“We can map a character onto a single byte.” He closed his hand to make a fist. “If all bits are turned off, we’ll represent it as the ‘A’ character.”
Some students kept their eyes closed and tried to remember, while others opened them and wrote, ‘A = 00000000’ on their notebooks.
“But,” he lifted one finger, “if one bit is turned on, we will represent it as the ‘B’ character.”
‘B = 00000001’
“Then,” he lifted another finger. “If two bits are turned on, we will represent it as the ‘C’ character.”
‘C = 00000011’
He paused and asked himself if he wanted to complicate things even more. “Now,” he said and opened his eyes. “There is a way to count in binary. We are not counting in the proper way, we will save that for another class.” He closed his eyes once again. “So far, we can represent three characters. If we keep using this approach and turn on all the bits, we can represent nine characters in a byte.” He counted on his fingers. “One for each bit, and one when all bits are off.”
‘D = 00000111’’
Advertisement
‘E = 00001111’’
‘F = 00011111’’
…
He relaxed his hands and opened his eyes. “Why can’t we add more bytes to represent more characters?”
The students stopped writing.
“The answer is: we can.” He pointed to the character in the container. “This is an eight bit character, we can represent characters with more bits if we wanted. What we’re doing by representing characters is: we’re encoding them. There is an encoding method called ‘UTF-16’ which uses sixteen-bits or two bytes for each character. It also sometimes uses two sixteen-bits to represent even more characters.” He held his head. “We’re not going to cover this, if you want to learn more about it, simply search ‘UTF-16.’”
‘UTF-16’
“Now,” he rubbed his hands together. “What if we could use two integers to create another integer?”
‘Integer + Integer = Integer?’ As the student wrote that down, she realized, “well, of course! Adding two integers will produce another integer.”
“Precisely,” he said with a smile. “Adding two floats produces another float. What about booleans?”
“I would imagine it would be impossible to add two booleans.”
“Exactly. You cannot add two booleans together. However, there is something else you can do with a boolean that you can’t do with an integer or float.”
The students waited for his answer with their pens ready.
“Toggle. A true becomes false, and a false becomes true.”
“Is that like changing the sign of a number?”
The teacher wondered for a moment. “I never thought of it like that, but not exactly. To change a number’s sign, you need to multiply it by negative one. Whereas, a boolean cannot be multiplied, it can only be toggled. These are operators. A boolean has a toggle operator.”
‘Boolean operators: toggle’
“A float and integer have an addition, subtraction, multiplication, division, and modulus operator.”
‘Integer and float operators: addition, subtraction, multiplication, division, modulus’
“Note how the toggle operator only requires a single value, whereas the operators for integers and float require at least two.” He walked over to the door and opened it for his students. “A boolean has more operators than just the toggle, but we’ll get to that when the time comes.”
They walked into a room glowing with a piercing blue that radiated from the giant screen. Under the screen was a desk with a computer. The room was similar to their classroom except significantly darker and with a roof significantly higher. “Practicality,” said the teacher as he made his way to the computer. “I’ll show you how code is usually written.” He typed and the screen displayed:
int a = 1;
An organ appeared behind the students within a glass container. It had the top most bit turned on. “In statically-typed languages,” said the teacher. “You must declare the data type. In this case, the variable ‘a’ will always be an integer. In dynamically-typed languages, ‘a’ can be changed to any other data type and the type is not declared. The semicolon is like a period, required in some languages. It marks the ending of a statement.”
int a = 1; int c = a + a + 1;
The organ split into an identical copy, which sunk and appeared in another container. The original organ split again, the clone sunk again, and was injected into the other container from the bottom. Then a new organ, which was not split, was injected into the container. The first two organs approached and dissolved into each other, making a new organ with one bit on that was one lower than the original. Then, the new organ dissolved into the remaining organ, which created another organ with the first bit and second bit on. “The original container represents variable ‘a,’” said the teacher. “While the new container represents variable ‘c.’” The teacher left the computer and approached the students. “Remember the addition operator?”
The students nodded.
“What if we could add characters together to create words?” He paused. “Well, we can. Let me show you how characters are declared first.” He went back to the computer. He cleared the screen and the containers sunk into the floor, then typed:
char character = ‘A’;
An organ with two bits on that were separated by five bits appeared. A binary state of: 1000001. “We can’t simply add characters together, that would throw an error. But,” he said, cleared the screen and typed:
string characters = “A” + “B”;
A single container containing two organs emerged. “We can add strings together. Strings are a data type. However, they are special, since they are made up of another data type. A string is a sequence of characters. Note how I used double quotes to declare a string and single quotes to declare a character. What I wrote can also be written as:”
string characters = “AB”;
The container stood in place. “It’s the same result,” he said. “In fact, we can also do this:”
string characters = “AB” + 2;
Another organ was injected into the container and floated beside the other two, with a binary state of: 110010. “Here, the integer two is being converted into a string. And, the binary state of a string representing the number two is different from the binary state of an integer representing the number two.”
string characters = “AB” + 2 + 3;
An organ was injected, and floated beside the organ representing two. “Now, watch.”
string characters = “AB” + (2 + 3);
The organ representing two and three were ejected and replaced with another two organs that were identical in representation but of type integer. They dissolved together making a new organ with the binary state of: 101. Which was then ejected and replaced with another organ with the binary state of: 110101. “You’re seeing the conversion from string-to-integer and integer-to-string when you see the ejections. Before I added the brackets, I was adding strings together. When I added the brackets, I was adding two integers together, so it got rid of the string representations and injected the integer representations. Then, it added them together, giving us the integer five. Finally, it was ejected and we were returned five in its string representation which was concatenated onto the ‘AB’ string.”
string characters = “AB5”;
The container stood still as the end result of the new code was the same. “The addition of strings is called concatenation.”
Advertisement
- In Serial154 Chapters
The Accidental Pimp
Quentin is a deeply depressed man, a hermit and anonymous celebrity. Razia is a fast woman, perpetually on the run. When a chance meeting brings the two of them together, life in Orchrisus becomes more bearable with someone to watch their backs. Soon, Quentin is dragged deep into an unfamiliar world of criminals, lowlifes, and weirdest of all: a social life. Updates on Tuesdays and Fridays!
8 273 - In Serial7 Chapters
FATE TWO[sci-fi/fantasy LIT RPG]
When soul is lost between worlds, one race will do whatever it takes to retrieve it. Even if it means crashing these worlds together in a way the inhabitants of both could never expect. This soul would eventually develop into a human with immeasurable power...but this story isn't about him its about a young boy who was thrust into this whole mess before anyone, and has to figure out how to be strong enough not to repeat the future. ----- The paper read Humanity's last stronghold has been breached under the text a picture of what he recognized as New York, and above it an odd date. “December 8th 2028” Tomb mumbled to himself in shock, “what am i doing 6 years from the present” As if the man had supernatural powers, he heard Tom “Going insane from mana, you crazy mage did you just realise it only took us 3 years to pulverize you fools” the man maniacally laughed. Then turning towards the tall man, he got serious and said “Kanna, if you had just surrendered yourself at first we would have made this takeover much quicker, but you” the man seethed with anger “you fought back, nothing is worse than humans standing together.” The LIT RPG elements have been planned for the future and will not be the main focus but more will be written I assume around chapter 10
8 302 - In Serial14 Chapters
Dream Dungeon
Welcome to the dream dungeon. Ely suddenly finds himself in a mysterious dungeon accessed only through sleeping. Many people are drawn into this dream world, confused and mystified. Those in this dungeon must kill monsters to survive; maybe even each other. Join Ely as he struggles to survive a ruthless environment. What replaces his rest is untold trauma. What seems like an innocent game trope turns into a nightmare. This is a story of tragedy and the path to ultimate power. All in the hopes of an uncertain survival. _________ This fiction has NOT been abandoned. I made a haughty promise earlier to not worry because I'll continue this series, and with things lately, I've only proved myself a liar. Further promises dwindled, and I've lost trust. So many things have been going on recently that I've been booked. I will refrain from making any future guarantees or promises as my busy schedule will stay with me for a long long while. Time for me to actually spend on writing and revising won't appear until at the least November 19. I won't say expect that's when I'll restart, but you can expect expecting it to maybe happen. That's really shallow. But with everything going on, I've let my small reading base down. I apologize. I still stick by my statement though that I won't abandon this project. I plan to stick it to the end, no matter the delay. Most importantly, thank you everyone; readers who both like and dislike my work. I appreciate your time spent on my dumb imagination. Stay toasty my readers in this winter season. Cheers. UPDATE: We're back on track. Thank you for your patience. Any future readers, heyo! Glad you're here. UPDATE 2: So far it's been 21 days since I last uploaded a chapter. The best thing done for any fiction, no matter how good it is, is that it continues, and I have a bad history with that. 1 fiction on hiatus and already more delays with less than 20 chapters in this fiction. I've been very preoccupied with adding more things to do in my life rather than actually committing to any particular thing. That applies primarily to this. I cannot abandon this, as busy as my future looks and will look as I get busier and busier. Someday, I hope, I will be able to sit down and just write. just. write. But for now, I ask for patience. I suppose I'm glad this fiction hasn't picked up so that I don't disappoint too many people if any really. But I need to commit and it's going to happen sometime and sometime soon. No more flowery words. I'll see you later. UPDATE 3: It's very evident I won't be able to pick up this story for a while. With AP Testing, competitions, and other things I am busier than ever. But I must complete this fiction. I have too. Until next time. UPDATE 4: It is now the summer. I owe everyone an apology. Chances are, nobody's around to see this, and that is okay. I only blame myself for this sort of brokenness of a fiction, not that it is actually that bad but I am just exaggerating it for dramatic effect.But what's not exaggerated is the severity of my broken promise. I apologize for my naive claims about finishing a novel that I couldn't finish and that I didn't have the discipline to finish. Nor the skills, really, I was and am still an immature writer.What is to place now? I want to make it clear I understand this is my fault. I will man up to this. And I will accept any criticism. I understand I messed up. Reading Stephen King's On Writing made it clear to me that I need to do two things:Read lots.And write lots.I have done neither. If I don't have the time to read often, how do I expect to write? I need to become more experienced. I need to become a serious writer.So if I want to dream of continuing, I need to at least fulfill both requirements. I enjoy writing. I haven't written seriously outside of school in a while. I planned to write this summer and finish this. I made a lot of promises that I didn't keep.So there's that. I won't enact any self-pity, or be foolishly obsessed. What I did was wrong, and I must deal with it. I let down readers. And I apologize.I hope I can find forgiveness. This is a writer's sin.I won't promise I'll finish this. I intend to finish this, at some point, because writing is fun and I want to write. But how things are don't reflect that. Maybe I'll finish this at some point. Maybe I won't. I won't be naive to make that promise.I thank everyone who has read this if this is the end. If not, and hopefully not, I thank everyone who is to read future chapters. I thank everyone who allowed me to live in the miniscule little dream of mine as I passed my days. I thank everyone who cares enough to read this. Until next time, peace everyone. Thank you. You are all great readers and great people. I wish everyone the best in whatever reading/writing endeavors follow you henceforth.
8 78 - In Serial28 Chapters
Moonlust
Once a glorious utopian city, now a bloody field chained in the farthest icy desert in the world. Irongate, a floating city that traveled the world for decades, has fallen tragically into the depth of hell after immoral science practice has led the city into the creation of a new species, The Mooncallers. The Mooncallers have engaged in a never-ending fight against the surviving humans for fifty years, the city's advanced mechanism is decaying in the face of the vicious intelligent monsters who are activated by fullmoon and the battle must end. Abigail awakens in the stock prison of Irongate as a Mooncaller, unaware of what happened to her, she traces back her old memories in hope to become human again, but where does her loyalty belong?
8 172 - In Serial1072 Chapters
I Died and Got Summoned to Another World as a WHAT?!?!
Have you ever wondered what would happen if the hero was summoned by the villain instead of the people who need him?
8 1558 - In Serial17 Chapters
The Pig and the Frog
~completed~What do you want to be Beatrice? I mean when you grow up." Tobias says, while we share our last moments together. We lay on the grass. Two six year olds. Laying in our spot looking at the sky. I look over to him, into his sky blue eyes and smile. "You know what. I want to be a frog. I never have to leave you. And I can jump so high I can touch the sky. And I'll be free. Oh everything would be amazing!"He smiles at me and giggles. "I want to be a pig. Never have to leave you. AND I get to be as messy as I want!" We both burst into laughter. I'm going to miss this. I hear my mother calling me and my eyes fill with tears. "I'm going to miss you Toby!" I wrap my small arms around him and look into his chubby little face. "I will miss you to, Trissy."
8 103

