“Halt! Who goes there?” The sentinel on duty at the castle was wide awake. Our sentinel values don’t carry weapons or defend ramparts, but they perform useful guarding tasks in our programs. In computer science, a sentinel value is a value that would not normally occur in input and serves as a marker of the end of input. Occasionally they can also be in a location in an array, not at the end of the data, but representing when a condition has been met. Two examples are discussed below.
Debugging for Beginners
Ugh! Bugs. They’re always crawling around and flying in your face when you least expect. The same applied to computer science bugs. They’ve been around since 1947 with the early computers, and continue to annoy us today. The first recorded case of a bug was a moth that Grace Hopper found jamming a relay switch in September 1947 (http://www.computerhistory.org/tdih/september/9/). While not much could be done about moths flying into relay switches except climbing in and pulling them out, today we can debug without having to leave our chairs.
Shamrock Treasure Hunt
Leapin’ Leprechauns! It’s St. Patrick’s Day and the leprechauns still can’t find a safe place to hide their gold. They think they’ve gotten crafty and found a better place, but this game shows they might need to try again. Similar to minesweeper, the Shamrock Treasure Hunt displays the distance to the leprechauns’ gold when a tile is clicked. Continue reading “Shamrock Treasure Hunt”
Traditional Caesar Cipher
Julius Caesar was worried. He needed to get a letter back to Cicero, the consul of Rome, but it had to travel through enemy territory. His solution? Shift every letter to the third letter after it, wrapping around so that A became D and Y became B. Here we’ll implement his idea in a computer program. Continue reading “Traditional Caesar Cipher”
Files that Make You Smile
Files. Those floppy, large things full of paper that used to be the bane of office workers are now electronic. No more lifting stacks of paper and having a couple of papers fall on the floor and get out of order! Instead we have to keep even more files in order inside folders, inside other folders on our computers. Not surprisingly, we have programs that can read and write files so we don’t have to do everything manually. Continue reading “Files that Make You Smile”