![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Added HangmanGame class, but does not work yet
Dependencies: SDFileSystem app epson mbed msp430 pl tests
Diff: hangman.h
- Revision:
- 0:fa7450a43b99
- Child:
- 1:a5ec6f9dcf0d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hangman.h Mon Dec 04 09:32:20 2017 +0000 @@ -0,0 +1,56 @@ +// +// Filename: hangman.h +// +// Class for the hangman game played on pagesensor and pageflexenable. +// + +// include guards + +#include <memory> +#include "mbed.h" +#include "log.h" +//include more files, e.g. where eink display is changed, and to read from SD card + +namespace Flexbook +{ + +class HangmanGame +{ +public: + // Constructor needs to be explicit. + explicit HangmanGame(); + + // Destructor + ~HangmanGame(); + + // Game status indicator + boolean finished = false; + +private: + // Word to be guessed, word guessed so far + char[14] word, guessed; + + // Number of letters in word to be guessed + char wordlength; + + // Currently selected and previous position on the alphabet matrix + char currentpos, oldpos; + + // Status indicator for each letter on the alphabet matrix, already used or not? + boolean[27] alphabet; + + // Number of wrong guesses, equals number of elements of hanging man drawn + char hangstage; + + // Routine to determine how to move the cursor after electrode touch + char movecursor(char oldpos, char buttonnumber); + + // Routine to run after confirming selection of a position in the alphabet matrix + void select(); + + // Routine to redraw the alphabet matrix after a cursor move + void redrawalphabet(char newpos, char oldpos); + +}; + +} \ No newline at end of file