DEV Community

Cover image for Alice: Finite Automata kind of simple to understand.
Meu57
Meu57

Posted on • Updated on

Alice: Finite Automata kind of simple to understand.

Image description

[Next day]
Alice: (breathing in the fresh air) Isn't it amazing how quickly the weather can change? Just last night, we were cooped up inside because of the storm.

Bob: (smiling) Absolutely. It's like nature's own version of nondeterminism. Speaking of which, did you finish reading that chapter on finite automata?

Alice: I have read about finite automation and I find finite automata kind of simple to understand.

Bob: I am glad that you find it simple.

Alice: Yeah, made an analogy for that to explain to myself.

Bob: that's interesting I would love to hear that tell me I am excited.

Alice: okay we know what states are, right and we know that states are depends on input right as we see in light switch example. So, you must have played Snakes and Ladders in your childhood.

Bob: Oh man, nostalgia!

Alice: So, we take here three states and two inputs 0 and 1 like we take two inputs in light switch but now here we have a snake-ladder game, and we have a dice too in our dice, there are only two numbers you can get, first is '1' and second is '0', right. Now, suppose your player is at home (starting point) and until you get a 1 on the dice, you will not come out from your house. Now suppose instead of ladders, you assume that there are states which can bring you upward or downward same Snakes and Ladders game.

Bob: Okay!!! go ahead it sounds interesting

Alice: yeah, but there is a catch in the game there are limited chances to roll the dice in this game.

Bob: okay so snake and ladder with limited chances to roll the dice.

So now start in state q1 which is starting point of our player or can say home.

  1. You roll dice and suppose you got 1 (on q1 state if dice get 1), then your player will transition go from q1 (ladder brings your player) to q2 (state).

  2. Now you are on q2 state, and you roll dice and suppose you get 1 again (on q2 state if dice gets 1), then the state will not change your player will remain on the q2 state.

  3. Now you are on q2 state, and you roll dice and suppose you get 0 (still you are on q2 now you roll dice and get 0), then you will move to q2 to q3 state.

  4. Now you are on q3 state, and you roll dice, and you get 1 (now you are on q3 now you roll dice and get 1), then you will come back q3 to q2.

Okay, so in this game we have limited chances to roll the dice that's why if you reach the destination which is the final state or can say in the last chance of rolling dice keeps you on the final state or brings you to the final state which is our destination, then you will win or lose.

Bob: That's something new even I have to say, your analogy is quite creative! It simplifies the concept of finite automata by comparing it to a familiar game. In finite automata, we have a set of states and the system transitions between these states based on input, similar to moving on a game board based on dice rolls.

In your analogy, the dice rolls represent the input symbols (1 and 0), and the states (q1, q2, q3) represent positions on the game board. The rules of moving between these states based on the dice rolls are like the transition functions in finite automata. And just like having limited chances to roll the dice, finite automata have a limited sequence of inputs to reach a final state.

This is a great way to visualize the process of state transitions in finite automata. It’s important to remember that in actual finite automata, the transition functions are predefined, and the system deterministically follows these rules to process a string of inputs and decide whether to accept or reject it.

NextPage
Back

Top comments (0)