Compare commits
2 commits
a1560f1611
...
d59798b7e8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d59798b7e8 |
||
|
|
fa9d534e94 |
6 changed files with 38 additions and 12 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -23,8 +23,7 @@
|
||||||
*.debug
|
*.debug
|
||||||
*.yml
|
*.yml
|
||||||
html/
|
html/
|
||||||
nbproject/private/
|
nbproject/*
|
||||||
nbproject/Package-*.bash
|
|
||||||
build/
|
build/
|
||||||
nbbuild/
|
nbbuild/
|
||||||
dist/
|
dist/
|
||||||
|
|
@ -42,4 +41,5 @@ chessmcu_default/
|
||||||
localTest/
|
localTest/
|
||||||
docs/
|
docs/
|
||||||
.ca/
|
.ca/
|
||||||
*.kate-swp
|
*.kate-swp
|
||||||
|
*orig
|
||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "doxygen-awesome-css"]
|
||||||
|
path = doxygen-awesome-css
|
||||||
|
url = https://github.com/jothepro/doxygen-awesome-css.git
|
||||||
10
Doxyfile
10
Doxyfile
|
|
@ -540,13 +540,13 @@ EXTRACT_ALL = YES
|
||||||
# be included in the documentation.
|
# be included in the documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_PRIVATE = NO
|
EXTRACT_PRIVATE = YES
|
||||||
|
|
||||||
# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
|
# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
|
||||||
# methods of a class will be included in the documentation.
|
# methods of a class will be included in the documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_PRIV_VIRTUAL = NO
|
EXTRACT_PRIV_VIRTUAL = YES
|
||||||
|
|
||||||
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
|
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
|
||||||
# scope will be included in the documentation.
|
# scope will be included in the documentation.
|
||||||
|
|
@ -1146,7 +1146,7 @@ EXAMPLE_RECURSIVE = NO
|
||||||
# that contain images that are to be included in the documentation (see the
|
# that contain images that are to be included in the documentation (see the
|
||||||
# \image command).
|
# \image command).
|
||||||
|
|
||||||
IMAGE_PATH =
|
IMAGE_PATH = docs/images
|
||||||
|
|
||||||
# The INPUT_FILTER tag can be used to specify a program that Doxygen should
|
# The INPUT_FILTER tag can be used to specify a program that Doxygen should
|
||||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||||
|
|
@ -1456,7 +1456,7 @@ HTML_STYLESHEET =
|
||||||
# documentation.
|
# documentation.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
HTML_EXTRA_STYLESHEET =
|
HTML_EXTRA_STYLESHEET = doxygen-awesome-css/doxygen-awesome.css
|
||||||
|
|
||||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||||
# other source files which should be copied to the HTML output directory. Note
|
# other source files which should be copied to the HTML output directory. Note
|
||||||
|
|
@ -1479,7 +1479,7 @@ HTML_EXTRA_FILES =
|
||||||
# The default value is: AUTO_LIGHT.
|
# The default value is: AUTO_LIGHT.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
HTML_COLORSTYLE = AUTO_LIGHT
|
HTML_COLORSTYLE = LIGHT
|
||||||
|
|
||||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||||
# will adjust the colors in the style sheet and background images according to
|
# will adjust the colors in the style sheet and background images according to
|
||||||
|
|
|
||||||
1
doxygen-awesome-css
Submodule
1
doxygen-awesome-css
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 60366c3d0423a7181e94a0cfab404f0422eca3c7
|
||||||
|
|
@ -6,6 +6,14 @@
|
||||||
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
// defined by the Mozilla Public License, v. 2.0.
|
// defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
||||||
|
/** @file Board.hpp
|
||||||
|
* @brief The header file for the Board class
|
||||||
|
*
|
||||||
|
* This contains the class definition for the logical representation of the chessboard
|
||||||
|
* itself, as well as a few ancillary enums and forward declarations to make the code
|
||||||
|
* easier to read (hopefully). Unlike the Piece.hpp header, there's no inheritance
|
||||||
|
* or virtual functions so this "half" of the code is a bit simpler to follow.
|
||||||
|
*/
|
||||||
#ifndef BOARD_HPP
|
#ifndef BOARD_HPP
|
||||||
#define BOARD_HPP
|
#define BOARD_HPP
|
||||||
|
|
||||||
|
|
@ -14,16 +22,29 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Piece.hpp"
|
#include "Piece.hpp"
|
||||||
// suggested to forward declare here, and put include in the .cpp
|
|
||||||
class Piece;
|
class Piece;
|
||||||
|
|
||||||
|
/** @enum Players
|
||||||
|
* @brief An enum for the white and black players
|
||||||
|
*/
|
||||||
enum Players { PL_WHITE, PL_BLACK };
|
enum Players { PL_WHITE, PL_BLACK };
|
||||||
struct Square;
|
struct Square;
|
||||||
|
|
||||||
|
/** @class Board Board.hpp inc/Board.hpp
|
||||||
|
* @brief This class abstracts the chess board itself
|
||||||
|
*
|
||||||
|
* The heart of the entire code is contained in the member variable boardGrid, which
|
||||||
|
* is a representation of the board. It's a 2D vector of Pieces, which are stored using
|
||||||
|
* smart pointers. When other functions want to view the board, they do so with the included
|
||||||
|
* getPieceAt() getters, which return raw pointers so ownership isn't transferred.
|
||||||
|
*
|
||||||
|
* Outside functions/methods can also change the state of the board with setPieceAt() which
|
||||||
|
* can allow one to move a piece (empty squares being nullptr) or add pieces to the Board when
|
||||||
|
* required.
|
||||||
|
*/
|
||||||
class Board {
|
class Board {
|
||||||
private:
|
private:
|
||||||
friend class Piece; // this doesn't seem to do anything
|
std::vector<std::vector<std::unique_ptr<Piece>>> boardGrid; /**< This holds the game state. It is a 2D vector of Piece types, or nullptr for empty squares @image html boardGrid.png "Logical diagram of boardGrid vector" */
|
||||||
std::vector<std::vector<std::unique_ptr<Piece>>> boardGrid;
|
|
||||||
Players playerTurn;
|
Players playerTurn;
|
||||||
// let's get super object-oriented, baby
|
// let's get super object-oriented, baby
|
||||||
// these help the getters and setters access the boardGrid
|
// these help the getters and setters access the boardGrid
|
||||||
|
|
@ -48,6 +69,7 @@ class Board {
|
||||||
virtual ~Board();
|
virtual ~Board();
|
||||||
|
|
||||||
// These are to allow Piece to access Board in a controlled way
|
// These are to allow Piece to access Board in a controlled way
|
||||||
|
// instead of adding a friend declaration for every subclass
|
||||||
// ----- Getters -----
|
// ----- Getters -----
|
||||||
Piece* getPieceAt(int r, int f) {
|
Piece* getPieceAt(int r, int f) {
|
||||||
return at(r, f).get();
|
return at(r, f).get();
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ struct Move {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Piece Piece.hpp "inc/Piece.hpp"
|
* @class Piece Piece.hpp inc/Piece.hpp
|
||||||
* @brief A class abstracting chess pieces
|
* @brief A class abstracting chess pieces
|
||||||
*
|
*
|
||||||
* This is a polymorphic base class containing the basic properties all chess pieces have.
|
* This is a polymorphic base class containing the basic properties all chess pieces have.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue