Title: eMancala
1eMancala
- Sasa Junuzovic
- Jeff Terrell
2eMancala Architecture
Program
User-Interface
3eMancala Architecture
Program
Output
Input
User-Interface
Bowl Counts
Valid Bowl
Bowl Clicks
Invalid Bowl
Player Color Selection
Status Messages
Enabled Buttons
Button Clicks
Last Move Info
4Computer Opponent
Program
Opponent
5Computer Opponent
User clicks on a bowl
Program
Sends game state to UI
Opponent
Logic
Sends game state to opponent
Validate move Set bowl counts
6Computer Opponent
Program
Sends game state to UI
Opponent
Logic
Sends game state to opponent
Opponent picks a bowl
Validate move Set bowl counts
Hmmm ... Tsk, tsk, tsk, ...
7Computer Game
Game Starter
Computer Game
Network Game
8Network Game
Running on port 31337 eleet
Game Starter
Java RMI Registry
Host
Network
Running on port 31337 eleet
Client
Game Starter
Java RMI Registry
9Network Game
Program
Program
Network
10Network Game
Program
Program
Network
11Network Game
Program
Program
Network
Type of opponent (human vs. computer) is
transparent to the program
Both implement the same interface
12Network Game
Jeff's UI is updated
Jeff clicks on a bowl
... as is Rufus'
Program
Program
Network
Which is an RMI call
13Handling Simultaneous Events
He must not know who I am ...
I am the CSSA president!
Almighty Jeff forfeits the game
Rufus makes losing move
Meanwhile ...
Program
Program
Network
?
Unhandled race conditions can leave application
in an invalid state
14Handling Simultaneous Events
Game forfeited
Losing move
Forfeit game
Event serializer (synchronized in Java
speak)
15Handling Simultaneous Events
Game forfeited
Losing move
Move not processed because game is forfeited
Forfeit game
Event serializer also used for events related to
establishing a network game
Event serializer
16Demo
17QA