Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem app epson mbed msp430 pl tests
hangman.h
00001 // 00002 // Filename: hangman.h 00003 // 00004 // Class for the hangman game played on pagesensor and pageflexenable. 00005 // 00006 00007 // include guards 00008 00009 #include <memory> 00010 #include "mbed.h" 00011 #include "log.h" 00012 //include more files, e.g. where eink display is changed, and to read from SD card 00013 00014 namespace Flexbook 00015 { 00016 00017 class HangmanGame 00018 { 00019 public: 00020 // Constructor needs to be explicit. 00021 explicit HangmanGame(); 00022 00023 // Destructor 00024 ~HangmanGame(); 00025 00026 // Game status indicator 00027 bool finished; 00028 00029 private: 00030 // Word to be guessed, word guessed so far 00031 char word[14]; 00032 char guessed[14]; 00033 00034 // Number of letters in word to be guessed 00035 char wordlength; 00036 00037 // Currently selected and previous position on the alphabet matrix 00038 char currentpos; 00039 char oldpos; 00040 00041 // Status indicator for each letter on the alphabet matrix, already used or not? 00042 bool alphabet[27]; 00043 00044 // Number of wrong guesses, equals number of elements of hanging man drawn 00045 char hangstage; 00046 00047 // Routine to determine how to move the cursor after electrode touch 00048 char movecursor(char oldpos, char buttonnumber); 00049 00050 // Routine to run after confirming selection of a position in the alphabet matrix 00051 void select(); 00052 00053 // Routine to redraw the alphabet matrix after a cursor move 00054 void RedrawAlphabet(char newpos, char oldpos); 00055 00056 }; 00057 00058 }
Generated on Tue Jul 12 2022 21:14:34 by
