Implementer det som er nevnt under og sjekk at alt fungerer som det skal ved å midlertidig bytte ut agen.get_next_signal() med en vanlig Input("Skriv neste signal") bare for å teste.
Create all rule objects for the FSM - and ensure they are listed in the desired order.
Initialize agent, keypad and LED board
Pseudo-kode:
state ← fsm-start-state
while state != fsm-end-state do:
# Get next signal, typically from the keypad
signal ← agent.get_next_signal()
# (Rule-Application Loop)
For rule in fsm.rules:
IF rule.match(state, signal):
state ← rule.next_state
agent.do_action(rule.action, signal)
GO TO (**)
(**)
End For
End While
Implementer det som er nevnt under og sjekk at alt fungerer som det skal ved å midlertidig bytte ut agen.get_next_signal() med en vanlig Input("Skriv neste signal") bare for å teste.
Create all rule objects for the FSM - and ensure they are listed in the desired order.
Initialize agent, keypad and LED board
Pseudo-kode:
Shutdown agent, keypad, LED board, etc.
💡 Tips fra lærer
HUSK at reglene sin rekkefølge har mye å si!