-
Notifications
You must be signed in to change notification settings - Fork 0
/
board.h
46 lines (38 loc) · 1.01 KB
/
board.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
/*************************************************************
*
* Copyright (C) 2010 John O'Laughlin
*
* All rights reserved.
*
*************************************************************
*/
#ifndef BOARD_H
#define BOARD_H
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include "config.h"
using namespace std;
class Board
{
public:
Board(int width, int height, const Config *config);
void clear();
inline bool isEmpty() const { return _empty; }
inline const Config* config() const { return _config; }
void writeColumnHeaders(ostream &o);
void writeHorizontalLine(ostream &o);
void writeRows(ostream &o);
void writeRow(ostream &o, int row);
void writeLetter(ostream &o, int row, int col);
void writeSquare(ostream &o, int row, int col);
private:
int _width;
int _height;
const Config *_config;
bool _empty;
char _letters[MAXIMUM_BOARD_SIZE][MAXIMUM_BOARD_SIZE];
};
ostream &operator<<(ostream &o, Board &board);
#endif