Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Finite-state machine
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Example: coin-operated turnstile == [[File:Turnstile state machine colored.svg|thumb|upright=1.5|State diagram for a turnstile]] [[File:Tornelli.jpg|thumb|200x200px|A turnstile]] An example of a simple mechanism that can be modeled by a state machine is a [[turnstile]].<ref name="Koshy">{{cite book | last = Koshy | first = Thomas | title = Discrete Mathematics With Applications | publisher = Academic Press | year = 2004 | pages = 762 | url = https://books.google.com/books?id=90KApidK5NwC&pg=PA762 | isbn = 978-0-12-421180-3}}</ref><ref name="βββ?">{{cite web |last = Wright |first = David R. |title = Finite State Machines |work = CSC215 Class Notes |publisher = David R. Wright website, N. Carolina State Univ. |year = 2005 |url = http://www4.ncsu.edu/~drwrigh3/docs/courses/csc216/fsm-notes.pdf |archive-url = https://web.archive.org/web/20140327131120/http://www4.ncsu.edu/~drwrigh3/docs/courses/csc216/fsm-notes.pdf |url-status = dead |archive-date = 27 March 2014 |access-date = 14 July 2012 }}</ref> A turnstile, used to control access to subways and amusement park rides, is a gate with three rotating arms at waist height, one across the entryway. Initially the arms are locked, blocking the entry, preventing patrons from passing through. Depositing a coin or [[Token coin|token]] in a slot on the turnstile unlocks the arms, allowing a single customer to push through. After the customer passes through, the arms are locked again until another coin is inserted. Considered as a state machine, the turnstile has two possible states: ''Locked'' and ''Unlocked''.<ref name="Koshy" /> There are two possible inputs that affect its state: putting a coin in the slot (''coin'') and pushing the arm (''push''). In the locked state, pushing on the arm has no effect; no matter how many times the input ''push'' is given, it stays in the locked state. Putting a coin in β that is, giving the machine a ''coin'' input β shifts the state from ''Locked'' to ''Unlocked''. In the unlocked state, putting additional coins in has no effect; that is, giving additional ''coin'' inputs does not change the state. A customer pushing through the arms gives a ''push'' input and resets the state to ''Locked''. The turnstile state machine can be represented by a [[state-transition table]], showing for each possible state, the transitions between them (based upon the inputs given to the machine) and the outputs resulting from each input: ::{| class="wikitable" ! Current State ! Input ! Next State ! Output |- ! rowspan="2"|Locked | coin || Unlocked || Unlocks the turnstile so that the customer can push through. |- | push || Locked || None |- ! rowspan="2"|Unlocked | coin || Unlocked || None |- | push || Locked || When the customer has pushed through, locks the turnstile. |} The turnstile state machine can also be represented by a [[directed graph]] called a [[state diagram]] ''(above)''. Each state is represented by a [[node (graph theory)|node]] (''circle''). Edges (''arrows'') show the transitions from one state to another. Each arrow is labeled with the input that triggers that transition. An input that doesn't cause a change of state (such as a ''coin'' input in the ''Unlocked'' state) is represented by a circular arrow returning to the original state. The arrow into the ''Locked'' node from the black dot indicates it is the initial state.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Finite-state machine
(section)
Add topic