Computation – Intro to Automaton (part 1)


Using Pictures for Patterns

Imagine if someone told you to check a queue of an unknown length to see if it contained an even number of zombies. How would you do it?

More than likely you will remember whether you have seen an odd number of zombies, or an even number. If we wished to produce an image of this, it may look like this:

note: 0=zombie

auto1

So, every time we see a ‘zombie’, we switch from the EVEN state to the ODD state, and vice-versa.

Now we have this, what would you do if you saw a ‘non-zombie (human)’? Well, with this current image nothing. So let’s add in some arrows for the ‘human’s. Also, we need to tell the person which state that they are required to start in, so lets throw that in as well. So now we have:

note: 1=human (non-zombie)

auto2

The way we show which state they need to start in, is declared via the arrow that points from nothing to the EVEN state, this is known as the start state. Now that this is done, we need to think. How do we know whether we have finished in the EVEN or the ODD state? This is declared by a double-ringed state, also known as an accepting state.

auto3

——————————————————————————————————-

Lets take this idea to another problem. Lets say, for example, that we are interested in whether a given queue has a ‘zombie’ in every position that is a multiple of 2, such as positions 2, 4, 6 etc. So we need to start in some state, and for the first person, we don’t really care what it is, either a ‘zombie’ or a ‘human’ will do here. So first we have something like this:

auto4

Now for the final state, this time if we see a ‘zombie’ we’re OK, but if we see a ‘human’ we need to reject it the given queue. We also need to include the accepting states so that we end up with:

auto5

Now all we need to do it neaten it up a little. Namely we need to say that if we are in state 1 and see a ‘zombie’, go back to state 0 rather than to a new state 2.

auto6

There we go, thats much better 🙂 , so now when were in state 1 and see a ‘zombie’ we go to state 0, or if we see a ‘human’ we go to state 3, also known as a dump state.

That’s the end of the intro to automatons, next we see Finite State Automata such as NFAs and DFAs.

Advertisements

About Badgerati
Computer Scientist, Games Developer, and DevOps Engineer. Fantasy and Sci-fi book lover, also founder of Cadaeic Studios.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: