Skip to content

Commit

Permalink
DOC: Add Mario state diagram example
Browse files Browse the repository at this point in the history
  • Loading branch information
HajuSchulz committed Feb 11, 2024
1 parent a7c5779 commit a1014fd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
12 changes: 7 additions & 5 deletions doc/cfsm_statepattern.puml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@startuml State Pattern

package "State Pattern" {

class Context {
-state
+state
+operation()
}

Expand All @@ -17,9 +19,9 @@ class State2 {
+operation()
}

Context -r-> "1" State
State <|-- State1
State <|-- State2

Context -- State
State <|-d- State1
State <|-d- State2

}
@enduml
24 changes: 24 additions & 0 deletions doc/mario_states.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@startuml Mario State Machine

state SmallMario
state SuperMario
state CapeMario
state FireMario
state DeadMario

SmallMario --> CapeMario : Feather
SmallMario --> FireMario : FireFlower
SmallMario --> SuperMario : Mushroom

SuperMario --> SmallMario : Monster
SuperMario ----> CapeMario : Feather
SuperMario -> FireMario : FireFlower

CapeMario --> SmallMario : Monster

FireMario --> SmallMario : Monster
FireMario --> CapeMario : Feather

SmallMario --> SmallMario: Monster
SmallMario --> DeadMario : no more lifes
@enduml

0 comments on commit a1014fd

Please sign in to comment.