“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.
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”