![]() ![]() An important point is that Finite State-Transition Machines are "Turing Complete" Opens a new window (1). All the logic is handled by the states and their transitions. ![]() I am in state "cooking_awaiting_timer": - if "timer" happens, then I "stop_microwaves" and go into state "finish_and_beep" - if "door-opens" happens, then I "stop_microwaves" and go into state "pause_timer" - otherwise continue cooking, stay in state "cooking_awaiting_timer" Notice that every state+event combination causes the main loop to call a very simple subroutine, like stop microwaves set next state = "finish_and_beep" There is no complicated logic inside any of the state subroutines. Part of my State-Transitions might go like this : For example, suppose I am a microwave oven. For the time being, we are limited to a finite number of states. The "Finite" part is academic : available computer memory is constantly growing, but it will be a long while before we have an infinite amount to play with. In other words, it is a simple "machine" that does transitions from one state to another according to rules that you provide. The main body of the program is a simple loop that It goes like this :- When I am in state "SA": - if "Event1" happens, then I will do "Action1" then go into state "SB" - if "Event2" happens, then. The "Finite State-Transition Machine" is a very simple but awesomely powerful programming technique. What is a "Finite State-Transition Machine"? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |