Tic-Tac-Flow : Model of a Hand-held Game
This model shows a variation of the classic tic-tac-toe game with an interesting twist. Only the last three moves of each player count. Thus the user needs to also account for the order in which the opponent has played the last few moves. This adds a nontrivial twist to the gameplay.
The model shows several Stateflow® charts interacting with each other. It exhibits how heavily event based logic can be captured naturally in Stateflow. It also describes Stateflow semantics such as parallel substates, graphical functions and MATLAB® handle graphics from Stateflow. The model is divided into several subsystems which naturally separate the game control from the I/O. This allows for the Stateflow code generated from the game control chart to be reused easily in a hardware component.
The GUI is implemented as a MATLAB figure which interacts with the Stateflow simulation. The button callback functions drive the inputs to the Stateflow chart.