1 / 12

AS Computer Studies

AS Computer Studies. Finite State Machines 2. Starter. Let’s play the Finite State Pirates Game REQUIRES Teacher Prep. Objectives. Understand the stages of problem solving. Become familiar with finite state machines and their purpose.

lcaballero
Download Presentation

AS Computer Studies

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. AS Computer Studies Finite State Machines 2

  2. Starter • Let’s play the Finite State Pirates Game • REQUIRES Teacher Prep

  3. Objectives • Understand the stages of problem solving. • Become familiar with finite state machines and their purpose. • Be able to create and construct a state transition table • Be able to construct a decision table

  4. Recap • A volunteer: Talk through this state transition diagram. 1, B State1 1, B Start 0, A State 0 0, A State2 2, ! 2, !

  5. Recap: Light Switch as a table • State Transitions are one way of describing a finite state machine. • Another way is a State Transition Table. It shows what states a FSM will move to based on the current state and other inputs. (Note there are NO outputs) Light-switch Down State 0 State 1 Light-switch Up

  6. Quick Task: Creating a State Transition Table (PRINT) Try and complete the State Transition Table 1, B State1 1, B Start 0, A State 0 0, A State2 2, ! 2, !

  7. Create your own State Transition Table S3 S1 S2 S0 Complete this State Transition Table based on the briefcase FSM. Note, there are NO outputs. <> = not

  8. Decision Tables • When solving logical problems there can be A LOT going on. How do make sure that everything is accounted for? • You use a Decision Table! – Show the outcomes for a given logical condition. • Can you work out what each condition shows: condition alternatives conditions actions action entries

  9. Steps to making a decision table • Draw boxes for the top and bottom left quadrants. • List the conditions in the top, left quadrant.  When possible, phrase the conditions as questions that can be answered with Yes or No. (You may need to figure these out first) •  List the possible actions in the bottom, left quadrant. (You may need to figure these out first) • Each condition can have Y or N values (so, 2 in total). Multiple the number of conditions by the number of possible values (2). Draw one column through the top and bottom right quadrants for each combination. For example, if there are three conditions then it would be 3*2 = 6 possible columns. 5. Enter all possible combinations of values in the columns in the top, right quadrant of the table. 6. For each column (each unique combination of conditions), mark an X in the bottom, right quadrant in the appropriate action row

  10. Whole Class Work through • Let’s draw it together. We will work out a solution • If it is a weekday go to work, even if its raining. If it’s a holiday, don’t go to work. If it’s a holiday and it’s not raining, go on a picnic. If it’s a holiday and it’s raining, relax and watch TV. • What are the rules / conditions? • How many condition alternatives will there be? (multiply the number of possible alternative values together. E.g. Y/N = 2 values. If there were 4 conditions it would be 2*2*2*2 – multiplying the number of rule values together, giving 16 conditions). • What are the actions?

  11. The Decision Completed Table

  12. Practice Tasks • Now it’s your turn to have a go. • Work through the printed activities: Decision Table Exercises • Teacher Answers • We will step through them. • Need help? Look at examples in your text book.

More Related