Added HangmanGame class, but does not work yet

Dependencies:   SDFileSystem app epson mbed msp430 pl tests

hangman.h

Committer:
group-FlexBook
Date:
2017-12-04
Revision:
0:fa7450a43b99
Child:
1:a5ec6f9dcf0d

File content as of revision 0:fa7450a43b99:

//
// 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);
    
};

}