including Finite State Machines Finite State MACHINES Also known as Finite State Automata Also known as FSM or State Machines Facts about FSM in general terms Finite State Machines are important ID: 674972
Download Presentation The PPT/PDF document "Finite State Machines Computer theory co..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Finite State Machines
Computer theory covers several types of abstract machines,
including Finite State Machines.Slide2
Finite State MACHINES
Also known as Finite State Automata
Also known as FSM, or State
MachinesSlide3
Facts about FSM, in general terms
Finite State Machines are important
part of intelligent
systems.
The most
famous FSM
is
the
Turing Machine, which can represent the logic of
almost any
computer algorithm.
FSMs exist
in everything from elevators to traffic lights; from vending machines to combination locks; from credit card number validation to complex artificial intelligence systems. Slide4
Main FSM Categories
Acceptors
Transducers
SequencersSlide5
Acceptors
Acceptor machines are useful in creating simple grammars. If
it is possible to build
an FSM to represent a
grammar,
it is called a regular language.
A single acceptor statement in a regular language is called a regular expression.
Example:
When
you learn a new programming
language for the first time, you see a sub-language
that
has syntax rules
. Regular
expressions
are used to
define the
syntax.Slide6
Transducers
Transducers read input files
and generate a corresponding output file.
These tools are used to consolidate multiple files
into a single large data
file.
Example:
Transducers
convert
from generic data into a game's final memory
format for faster loading time.Slide7
Sequencers
Sequencer
are FSMs are used to
control a sequence of events or actions.
Example Sequencers can be
used to model game behavior
.Slide8
Sequencers store two types of information
A set of states that represent the scenarios
of the game. These are the configurations that the AI will be
immersed in
.
A set of transitions that are conditions that
move a behavior from one scenario to another. These scenarios are described as the transition between two
states in a directed
way.
FSM sequencers depict
a complete network or collection of possible actions (the states) and ways to change from one action to the other.Slide9
Examine a basic Virtual pet
A pet
isHUNGRY
.
If you provide it with food, the pet
isEATING
that food, it will not be hungry anymore.
After eating (consuming energy calories), the pet
isPLAYING
.
Pet
isHUNGRY
again after burning calories all the consumed calories during play
.
Three states are described:
isHUNGRY
,
isEATING
,
isPLAYING
.
Statements that describe how and when the states are altered are called transitions.Slide10
Transitions
Assume the
pet begins in a
isHUNGRY
state.
If the user supplies food, the pet is in the state of
isEATING
.
If food
is consumed and the stomach is full, the
pet will transition into the
isPLAYING
state.
A pet
is always in one of a finite number of
states.
A Transition is
based on two things: the current state, and actions and conditions. Slide11
FSM:
virtual pet
Note:
A
dead pet cannot be revived.
Slide12
Implementation
Use a switch statement.
Each
of the cases in the switch controls a specific state and evaluates the possibility of changing states due to a specific transition in the automata being selected.
Each
state's activities can be divided into specific areas:
The name of the state
The default actions to be carried out in that state
The calculations to perform in order to evaluate outgoing transitionsSlide13
const
isHUNGRY:int = 1
;
const
isEATING:int = 2
;
var
state:int
;
switch
(state) {
case
isHUNGRY:
// default actions to be carried out when the pet is hungry
break;
case
isEATING:
//
default actions to be carried out when the pet is eating
break
;
.
.
.
}