Purpose: Instructions to play the game ----------------------------( 1)------------ retrieve state retrieve user input if state is empty: initialize state else: update state with input save the state report the state get ready for more input -----------------------------( 2)------------ retrieve state retrieve user input: information about which dice to hold we're sending one of two buttons (roll, store) if state is empty: initialize state else: update state with input save the state report the state get ready for more input: form with five text fields to indicate holding two submit buttons to roll dice or store combination -----------------------------( 3)------------ retrieve state retrieve user input: information about which dice to hold we're sending one of two buttons (roll, store) if state is empty: initialize state else: update state with input save the state: the five dice (as numbers): hidden fields info about which dice to hold: text fields number of rolls and overall attempts: hidden fields store a message in a hidden field HISTORY TABLE report the state: report the dice as images no hidden fields for holding dice info, text fields show it print the number of rolls and attempts as message HISTORY TABLE get ready for more input: form with five text fields to indicate holding two submit buttons to roll dice or store combination -----------------------------( 4)------------ retrieve state (*) retrieve user input: information about which dice to hold we're sending one of two buttons (roll, store) if state is empty: initialize state: d1 = some random number ... d5 = some random number keep1 = empty (there is a duality state/user input here) ... keep5 = empty rolls = 1 attempts = 1 message = "Welcome to this game" HISTORY TABLE is empty (n empty entries) else: update state with input(*) save the state: the five dice (as numbers): hidden fields (*) info about which dice to hold: text fields (*) number of rolls and overall attempts: hidden fields store a message in a hidden field HISTORY TABLE report the state: report the dice as images no hidden fields for holding dice info, text fields show it print the number of rolls and attempts as message HISTORY TABLE get ready for more input: form with five text fields to indicate holding two submit buttons to roll dice or store combination -----------------------------( 5)------------ retrieve state: read d1, ..., d5 from incoming hidden fields read keep1, ..., keep5 from incoming text fields NOTE: they are the only part of the state safe on the client read rolls, attempts, message and the HISTORY TABLE retrieve user input: information about which dice to hold (already read) we're sending one of two buttons (roll, store) if state is empty: initialize state: d1 = some random number ... d5 = some random number keep1 = empty (there is a duality state/user input here) ... keep5 = empty rolls = 1 attempts = 1 message = "Welcome to this game" HISTORY TABLE is empty (n empty entries) else: update state with input(*) save the state: the five dice (as numbers): hidden fields (*) info about which dice to hold: text fields (*) number of rolls and overall attempts: hidden fields store a message in a hidden field HISTORY TABLE report the state: report the dice as images no hidden fields for holding dice info, text fields show it print the number of rolls and attempts as message HISTORY TABLE get ready for more input: form with five text fields to indicate holding two submit buttons to roll dice or store combination -----------------------------( 6)------------ retrieve state: read d1, ..., d5 from incoming hidden fields read keep1, ..., keep5 from incoming text fields NOTE: they are the only part of the state safe on the client read rolls, attempts, message and the HISTORY TABLE retrieve user input: information about which dice to hold (already read) we're sending one of two buttons (roll, store) if state is empty: initialize state: d1 = some random number ... d5 = some random number keep1 = empty (there is a duality state/user input here) ... keep5 = empty rolls = 1 attempt = 1 message = "Welcome to this game" HISTORY TABLE is empty (n empty entries) else: update state with input: if user wants to store: add combination to HISTORY TABLE get new combination initialized: d1, ..., d5 as above roll = 1 attempt += 1 else: // user wants a new roll if roll == 3: tell them that you can't do that, they need to store it else: d1 = new random number unless we need to hold it ... d5 = new random number unless we need to hold it roll += 1 save the state: the five dice (as numbers): hidden fields (*) info about which dice to hold: text fields (*) number of rolls and overall attempts: hidden fields store a message in a hidden field HISTORY TABLE report the state: report the dice as images no hidden fields for holding dice info, text fields show it print the number of rolls and attempts as message HISTORY TABLE get ready for more input: form with five text fields to indicate holding (done) two submit buttons to roll dice or store combination -----------------------------( 7)------------ end of program details: here's the syntax for the HISTORY TABLE in the midterm prototype So the coding is straightforward because we didn't leave anything out. But it's not immediate. You still have to drive there... So towards the end of the game the table might look like this (dissected):