ConceptofState
Whentherobotdetectsthereisnolineunderneath,howcantherobot
knowitshouldstoporitshouldmovebackward?
Therobotneedstoknowwhetheritismovingoridle.Wecallthis
(“moving”or“idle”)astate.
Weneedtostorethestateandalsoamechanismtochangethestate
Weusememorytostorethestateandwespecifyunderwhatsituation
thestatewillchangeandwhatkindofactionswillbeexecutedundera
certainstate.
Wecallthisafinitestatemachine