/* word_guessing.pde [your info here] Word guessing game (like Word Mastermind) */ int stage; // the current stage of the game // - stage 0: mastermind enters secret phrase // - stage 1: player tries to guess secret phrase // - stage 2: player won game int count; // the number of guesses made so far String input; // stores user's keyboard inputs String answer; // stores secret phrase String message; // stores messages to display to player void setup() { size(500, 500); // drawing canvas size of your choice textSize(30); // text size of your choice fill(0); // text color of your choice reset(); } void draw() { background(255); if (stage == 0) { // YOUR CODE BLOCK 1 } if (stage == 1) { // YOUR CODE BLOCK 2 } if (stage == 2) { // YOUR CODE BLOCK 3 } } // record user keystrokes void keyPressed() { if(keyCode == ENTER || keyCode == RETURN) { // user pressed [Enter] // behavior should depend on game stage if (stage == 2) { // YOUR CODE BLOCK 6 } if (stage == 1) { // YOUR CODE BLOCK 5 } if(stage == 0 && input.length() > 0) { // YOUR CODE BLOCK 4 } } if ( (keyCode == BACKSPACE || keyCode == DELETE) && input.length() > 0 ) { // remove last character from input string input = input.substring(0,input.length() - 1); } if ( key >= ' ' && key <= '~' ) { // add key to input string // YOUR CODE BLOCK 7 } } // called when the user types a guess then presses [Enter] // returns true if the user input matches the secret phrase, and false otherwise boolean checkGuess() { int correct = 0; // YOUR CODE BLOCK 8 return false; // you will likely need to change (or move) this line } // function to reset the game void reset() { // YOUR CODE BLOCK 9 }