Upload
willa
View
13
Download
0
Embed Size (px)
DESCRIPTION
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 - PowerPoint PPT Presentation
Citation preview
Game Specific Options
(Pre-Initialized)
Board Size?Starting Position?
Allow Diagonal moves or
wins?Etc…
Play Game(Initialized)
Player is computer/hum
an?Who goes
first?Player NamesAnd of course
actually playing the
game
Start Specific Game
End Specific Game
Top Level GUI States
Initialization/De-initialization
Start Specific Game
Initialize core GUI
Buttons for changing player
names, whether a player is computer
or human, etc…
Initialize Game Specific Game
BoardCreate board
pieces, set board size, add bindings,
etc… ANIMATION!!!
End Specific Game
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
Play Game State
Game Specific Options
(Pre-Initialized)
Board Size?Starting Position?
Allow Diagonal moves or
wins?Etc…
Play Game(Initialized)
Player is computer/hum
an?Who goes
first?Player NamesAnd of course
actually playing the
game
Start Specific Game
End Specific Game
Play Game State (cont)
1: No Game Initialized YetGame board exists, but no game has been run
Board appears as is after Game Specific Initialize
Three Substates
2: Mid GameGame has been started but is not over
Pieces and board exist, and moves are shown
3: End GameGame has ended. Pieces and board exist, but moves are not shown.
Game Specific end game animation may have occurred
From State to State
1: No Game Started 2: Mid Game
2: Mid Game 2: Mid Game
2: Mid Game 3: End Game
3: End Game 2: Mid Game
1: No Game Started 3: End Game
State 1
1: No Game Started2: Mid Game or
3: End Game
New Game(button)
SetupSet 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
Driver Loop
Driver
Loop
Game OverGame Specific Game Over
Sequence
Primitive position?
3: End
Game
Player is human?
Show MovesGiven the move type,
current position, and move list with values and
remotenessShows the moves
appropriately based on move-type
2: Mid
Game
Player is computer?Get move
from databaseUpdate Globals
Handle MoveGame animates move
Board is visually set up to match the new-position
State 2
2: Mid Game2: Mid Game or
3: End Game
New Game(button)
SetupSet 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
Hide Visible Moves
Handle MoveGame animates move
Board is visually set up to match the new-position
Get Human MoveObtain the user move by
interaction with the game board
State 2 (cont) and State 3
2: Mid Game
Undo move
Graphically undoes the
move
Determine which type of undo is necessary
Show Moves
Driver Loop
This loop drives the game until a human player’s turn is at
hand
Hide Moves
Game Over Sequence Cleanup
Allows the “reversal” of a
Game Over Sequence so
the last position is re-displayed
3: End Game
Undo(button)
Showing Moves
All Moves(button)
Value Moves(button)
Best Moves(button)
Switch the currently shown moves to
selected
Overview
2: Mid Game
New Game(button)
SetupClear board
Draw board
Driver Loop
Hide Visible Moves
Handle Move
Get Human Move
1: No Game Started
3: End Game
Undo move
Which Undo?
Undo(button)
Game Over
Sequence Cleanup
Show Moves
Show Move
s