1 / 7

NFA: Vending Machine Simulation

NFA: Vending Machine Simulation. Steven Stockall. Intro. NFA-Nondeterministic Finite Automaton - several possible states from current state, type of finite state machine Goals: Create a function NFA that works in a simulation

noel
Download Presentation

NFA: Vending Machine Simulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NFA:Vending Machine Simulation Steven Stockall

  2. Intro • NFA-Nondeterministic Finite Automaton - several possible states from current state, type of finite state machine • Goals: • Create a function NFA that works in a simulation • Gain a greater understanding to the use of and applications for finite state machines • Applications: • Vending Machine • Elevator • Circuit hardware

  3. Design • Machine accepts dimes, nickels, and quarters • Monetary cap of $1 • Monetary states for all valid change inputs • Several purchase options: • Purchase items will vary in price • Invalid selections will return to current monetary state with prompt stating invalid selection • Valid selections will drop item and return correct change • ‘coin return’ button: • Returns change • Overflow: • Monertary input over $1 will be handled with an overflow state, this returns the amount of change equal to the amount over $1 entered into the machine by the user

  4. Design (cont.) • Code: • Design will be implemented in C# • Design will have a small user interactive window with which the user can interact with and test the program

  5. Code Organization • Main that starts the core program • Core: • Program starts with a $.00 state • based on user input will call one of the modules passing in the user input and the old state • modules will return new state • Module that handles monetary selection: • overflow will be handled within module • Module that handles item selection: • invalid selections return same state • valid selections return item adjust change amount and returns remaining change then returns to $.00 state • Module that handles coin return: • Returns coins • Returns to $.00 state

  6. Testing • Correct State transition: • test to check state to state transition • Correct State chaining: • test to check state transitions are correct for long transition chains • Correct input handling: • Buttons work properly • Correct cash overflow handling: • purposely test all possible overflow states

  7. Conclusion • Goals: • will be to see how a NFA works in real world applications • create a functioning NFA • create a workable vending machine simulation

More Related