-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
next piece window works correctly now
- Loading branch information
Showing
7 changed files
with
119 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef GAMEBOARD_HPP | ||
#define GAMEBOARD_HPP | ||
#include <vector> | ||
#include <algorithm> | ||
|
||
#define MAXBOARDH 1000 | ||
#define MAXBOARDW 1000 | ||
|
||
#define CLEAR_BLOCK ' ' | ||
static char board[MAXBOARDW][MAXBOARDH]; | ||
static int max_y = 0, max_x = 0; | ||
|
||
class GameBoard { | ||
public: | ||
GameBoard(int max_x, int max_y) { | ||
board_.resize(max_y); | ||
std::for_each(board_.begin(), board_.end(), [&max_x] (std::vector<char> & row) {row.resize(max_x,CLEAR_BLOCK);}); | ||
} | ||
bool isPopulated(int x, int y) const{ | ||
return (CLEAR_BLOCK != board_[y][x] ); | ||
} | ||
void populated(int x, int y, char what) { | ||
board_[y][x]= what; | ||
} | ||
void empty(int x, int y) { | ||
board_[y][x]= CLEAR_BLOCK; | ||
} | ||
size_t maxY() const { | ||
return board_.size(); | ||
} | ||
size_t maxX() const { | ||
return board_[0].size(); | ||
} | ||
private: | ||
std::vector<std::vector <char>> board_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters