File:  [Local Repository] / DewFind / GameBoard.h
Revision 1.1: download - view: text, annotated - select for diffs
Wed Mar 2 17:51:54 2011 UTC (13 years, 8 months ago) by nick
CVS tags: MAIN, HEAD
Initial revision

#pragma once

#include "Dewconst.h"
#include "Word.h"
#include "GameSquare.h"
#include <string>

using std::string;

class GameBoard
{
public:
	GameBoard();
	~GameBoard();
	void DrawBoard(CDC *xDC);
	void DrawWords(CDC *xDC);
	void LoadWordsFromFile(CString FN);
	void ClearBoard();
	void ClearWords();
	void ClearSelected();//Sets all Selected to false
	void SetUpBoard();
	bool IsGameOver();//Checks if all words are found
	bool SelectSquareMouse(int x,int y);
	int GetWordCount();
	int GetWordsFound();
private:
	//Functions
	void CreateAcross(int wordnumber);
	void CreateDown(int wordnumber);
	void CreateDiagonally(int wordnumber);
	void AddWord(CString word);
	void FillRandom(); //Fills onused squares with a char
	
	void SelectSquare(int x, int y);
	void CheckWords();
	void WordFound(int wordnumber);
	bool HandleAcross(int wordnumber);
	bool RandomAcross(int wordnumber);
	bool PlaceAcross(int boardx,int boardy,CString word,int wordnumber);
	bool HandleDown(int wordnumber);
	bool RandomDown(int wordnumber);
	bool PlaceDown(int boardx,int boardy,CString word,int wordnumber);
	int CheckLoc(int selx,int sely, int X,int X2,int Y,int Y2,int RTN);
	CString ChangeToBackward(int wordnumber);
	CString HandleBackward(int wordnumber);
	bool HandleSelection(int square);
	char RandomLetter();//Returns a random Letter A-Z
	//Values
	GameSquare board_[MAXROW][MAXCOL]; //used to show the board
	int selects_; //number of letters selected
	int wordcount_;  //count of words
	bool foundword_[MAXWORDS];
	CString words_[MAXWORDS];
};

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>