110 likes | 202 Views
Start Specific Game. End Specific Game. Top Level GUI States. Game Specific Options (Pre-Initialized) Board Size? Starting Position? Allow Diagonal moves or wins? Etc…. Play Game (Initialized) Player is computer/human? Who goes first? Player Names
E N D
Start Specific Game End Specific Game Top Level GUI States Game Specific Options (Pre-Initialized) Board Size? Starting Position? Allow Diagonal moves or wins? Etc… Play Game (Initialized) Player is computer/human? Who goes first? Player Names And of course actually playing the game
Initialize Game Specific Game Board Create board pieces, set board size, add bindings, etc… ANIMATION!!! De-Initialize core GUI Disables buttons, possibly shrinks or destroys windows De-Initialize Game Specific Game Board Return board to empty state prior to initialization End Specific Game Initialization/De-initialization Initialize core GUI Buttons for changing player names, whether a player is computer or human, etc… Start Specific Game
Start Specific Game End Specific Game Play Game State Game Specific Options (Pre-Initialized) Board Size? Starting Position? Allow Diagonal moves or wins? Etc… Play Game (Initialized) Player is computer/human? Who goes first? Player Names And of course actually playing the game
Play Game State (cont) Three Substates 1: No Game Initialized Yet Game board exists, but no game has been run Board appears as is after Game Specific Initialize 2: Mid Game Game has been started but is not over Pieces and board exist, and moves are shown 3: End Game Game has ended. Pieces and board exist, but moves are not shown. Game Specific end game animation may have occurred
1: No Game Started 1: No Game Started 2: Mid Game 3: End Game 2: Mid Game 2: Mid Game 2: Mid Game 3: End Game 3: End Game 2: Mid Game From State to State
New Game (button) Setup Set Up Global Variables and Prepare for New Game Clear board Return the board to a predetermined state Game Specific! Draw board Draws the new Game board given the initial position Driver Loop This loop drives the game until a human player’s turn is at hand State 1 2: Mid Game or 3: End Game 1: No Game Started
Game Over Game Specific Game Over Sequence 3: End Game Primitive position? Player is human? Show Moves Given the move type, current position, and move list with values and remoteness Shows the moves appropriately based on move-type 2: Mid Game Player is computer? Get move from database Update Globals Handle Move Game animates move Board is visually set up to match the new-position Driver Loop Driver Loop
Get Human Move Obtain the user move by interaction with the game board Hide Visible Moves New Game (button) Handle Move Game animates move Board is visually set up to match the new-position Setup Set Up Global Variables and Prepare for New Game Clear board Return the board to a predetermined state Game Specific! Draw board Draws the new Game board given the initial position Driver Loop This loop drives the game until a human player’s turn is at hand State 2 2: Mid Game 2: Mid Game or 3: End Game
3: End Game Driver Loop This loop drives the game until a human player’s turn is at hand Undo (button) Show Moves Game Over Sequence Cleanup Allows the “reversal” of a Game Over Sequence so the last position is re-displayed Determine which type of undo is necessary Undo move Graphically undoes the move State 2 (cont) and State 3 2: Mid Game Hide Moves
Showing Moves All Moves (button) Switch the currently shown moves to selected Value Moves (button) Best Moves (button)
Overview Setup Clear board Draw board New Game (button) 1: No Game Started Handle Move Driver Loop 2: Mid Game Get Human Move Hide Visible Moves Show Moves Undo move Undo (button) Game Over Sequence Cleanup Show Moves Which Undo? 3: End Game