An automaton.
You could think of the game as an automaton that processes the string of mouse moves and mouse clicks entered by the user.
Most modern games are more complicated than a simple automaton can handle. But often, within a game, there are puzzles that are exactly finite automata. When the solution to a puzzle requires a particular sequence of choices (say, of colored gems in a treasure chest) there is almost certainly an automaton.
If an automaton is implemented in Java,
objects of type String
or StringBuffer
could be used to hold the string.
But this chapter is not about programming.
(This will come later.)
Think of a string as a sequence of characters
independent of any implementation.
If a string is accepted by an automaton, the string is said to be recognized by the automaton. The strings that are recognized by the automaton form a set.
A finite-state automaton is designed to recognize
strings that follow a particular definition.
For example, an automaton can be designed to recognize
the strings that are legal variable names
in Java
(such as value
, item32
, MyBook
).
Another automaton might recognize
the strings that are legal integer literals in Java
(such as 134
or -27
or 0
).
Is 134.095
a legal integer literal in Java?