Designing - Consider perspectives. Example of taking a turn: Monopoly 1. Pre-turn activities a. If in Jail, post bail? b If has monopolies, build? 2. Roll the dice a. If in jail If it is doubles, move # spaces Otherwise, if third roll, Pay $50, move # spaces b. Else, move # spaces 3. Act according to the landing space if property if not owned, consider purchase if bought, get deed else bank auctions else pay rent ... etc. This is a Player activity, takeTurn(). Where it differs is in implementation between a human and a computer. Game Controller: To start game: - Game Pieces assigned - Money distributed - Play order established. (Roll die for order) ActivePlayers 0 1 2 3 Y N Y Y - While not end of game CurrentPlayer=getNextPlayer Bankrupt=CurrentPlayer.takeTurn() set their indicator to N if only one indicator is Y, that player wins Internet Interaction Rule: Send as little data as possible. Each terminal already has complete info on the game environment. In Monopoly, some initial data must be sent - Game Pieces - Die roll for order - Final player order What does the player send through the server when they take a turn? Build string (what, how many, where) Jail status Roll value + doubles flag What gets received when someone else is taking a turn? If string starts with build code, e.g. 0 means they built, 1 means they paid to get out of jail, 2 means a die roll follows, that should be followed by a code for whether the roll was doubles If it was a 0, then another string will be coming ======================================================================================= AJAX XML Processing - open command for a request object takes *method (i.e. get or post), *url *bool that, if true, means to make the request asynchronously > Synchronous requests are dangerous because they cause the main thread to wait for the response. ============================================================= Data base Statements - Ordinary - Prepared - has place holders to allow queries with varying parameters Java-SQL - executeUpdate - executeQuery SQL - CREATE - INSERT - UPDATE - DROP Others...