-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgboggle.h
executable file
·92 lines (79 loc) · 2.93 KB
/
gboggle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* File: gboggle.h
* ---------------
* The gboggle.h file defines the interface for a set of
* functions that
*
* 1. Draw the boggle board
* 2. Manage the word lists
* 3. Update the scoreboard
*/
#ifndef _gboggle_h
#define _gboggle_h
#include "genlib.h"
/*
* Type: playerT
* -------------
* This enumeration distinguishes the human and computer players.
*/
enum playerT {Human, Computer};
/*
* Constant: MAX_DIMENSION
* -----------------------
* This constant determines the largest acceptable values for the board dimensions.
*/
const int MAX_DIMENSION = 5;
/*
* Function: DrawBoard
* Usage: DrawBoard(4, 4);
* -----------------------
* This function draws the empty layout of the board having the
* specified dimensions. It should be called once at the beginning
* of each game, after calling InitGraphics() to erase the graphics
* window. It will draw the cubes, board, and scoreboard labels.
* The scores and word lists are set to zero. The boggle cubes are
* drawn with blank faces, ready for letters to be set using the
* LabelCube function. If either dimension is <= 0 or > MAX_DIMENSION,
* an error is raised.
*/
void DrawBoard(int numRows, int numCols);
/*
* Function: LabelCube
* Usage: LabelCube(row, col, letter);
* -----------------------------------
* This function draws the specified letter on the face of the cube
* at position (row, col). The cubes are numbered from top to bottom
* left to right starting with zero. Therefore, the upper left corner is
* is (0, 0); the lower right is (numRows-1, numCols-1). Thus, the call
*
* LabelCube(0, 3, 'D');
*
* would put a D in the top right corner cube. An error is raised if
* row or col is out of range for this boggle board.
*/
void LabelCube(int row, int col, char letter);
/*
* Function: HighlightCube
* Usage: HighlightCube(row, col, flag);
* -------------------------------------
* This function highlights or unhighlights the specified cube
* according to the setting of flag: if flag is true, the cube
* is highlighted; if flag is false, the highlight is removed.
* The highlight flag makes it possible for you to show which
* cubes are using when forming a word on the board. An error is
* raised if row or col is out of range for this boggle board.
*/
void HighlightCube(int row, int col, bool flag);
/*
* Function: RecordWordForPlayer
* Usage: RecordWordForPlayer(word, player);
* -----------------------------------------
* This function records the specified word by adding it to
* the screen display for the specified player and updating
* the scoreboard accordingly. Scoring is calculated as
* follows: a 4-letter word is worth 1 point, a 5-letter
* is worth 2 points, and so on. An error is raised if player
* is not a valid value for playerT (Human or Computer).
*/
void RecordWordForPlayer(string word, playerT player);
#endif