Exercise: Use VS to make a console app and also a Forms app for this number game. Use case: 1. Computer says: "Guess an int, M, in range 0..10: M = " (user types an int and computer verifies that it is legal) 2. Computer says: "I guess int, N, in range 0..10-M: N = blah" (blah is a randomly generated int in range 0..10-M) "now you type an int, P, such that M + N + P = 10: P = " (user types an int and computer checks if the sum totals 10) 3. Computer says: "You win!" or "You lose!" (based on the sum) Use random number generator as shown in example app. Do this to convert a string of digits, s, to an int: int n = Int32.Parse(s); ================================= How to assess: Test console app with a valid input, say, 4. Guess a winning second number. Repeat with 4 and guess a losing second number. Repeat with -2 as the first input to see if an error message is generated. Now, look at code and ask some question about it, e.g, "what happens right here?" Repeat the above with the Forms (GUI) app. If the app has two buttons on it, try to "break" the app by pressing the buttons in the wrong order. Look at the code and see how the app remembers that it has no input number at the start and that it has read one input number and is waiting to add it to the random number and the second input. Ask the student: "why does this code look so different from the console app?" =================================== Exercise 1 postmortem: The console app's code was written as "straight-line control". The Form app's code was "broken" into parts, and control "jumped" between human-user and machine. VS-style Forms with buttons work well for single-user _reactive systems_, where the program "reacts" to external events (e.g., button presses). (I) But not all systems are single-user or reactive, e.g., a computer clock or a multi-player game or a shared database or an operating system (II) And in practice, a large system is designed by teams, where one team codes the UI, one codes the data structures, and one codes the control algorithm ("protocol").