“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.
Tic-Tac-Toe
Want to make video games, but have limited programing skills? Then start here. We’ll explore a simple Tic-Tac-Toe that runs exclusively through your terminal or command prompt.
ASCII Fun
ASCII art like the greeting above is common, but ASCII characters are useful for a lot more. Represented in a Java in a manner identical to the first 128 unsigned integers, they can be substituted for ints at any time, and ints 32 -126 inclusive can be cast to chars and printed. While limited compared to the unicode set of characters (ASCII can’t represent á, for example), ASCII is the workhorse of most file systems.