Compare commits
2 commits
d59798b7e8
...
5359d0fb05
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5359d0fb05 |
||
|
|
ab26479c3c |
2 changed files with 62 additions and 14 deletions
26
Doxyfile
26
Doxyfile
|
|
@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8
|
||||||
# title of most generated pages and in a few other places.
|
# title of most generated pages and in a few other places.
|
||||||
# The default value is: My Project.
|
# The default value is: My Project.
|
||||||
|
|
||||||
PROJECT_NAME = "FrznChessboard MCU Code"
|
PROJECT_NAME = FrznChessboard
|
||||||
|
|
||||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
|
|
@ -54,7 +54,7 @@ PROJECT_NUMBER =
|
||||||
# for a project that appears at the top of each page and should give viewers a
|
# for a project that appears at the top of each page and should give viewers a
|
||||||
# quick idea about the purpose of the project. Keep the description short.
|
# quick idea about the purpose of the project. Keep the description short.
|
||||||
|
|
||||||
PROJECT_BRIEF = "All the code for the MCU inside the chessboard"
|
PROJECT_BRIEF = "PIC32MX code inside the chessboard"
|
||||||
|
|
||||||
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
|
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
|
||||||
# in the documentation. The maximum height of the logo should not exceed 55
|
# in the documentation. The maximum height of the logo should not exceed 55
|
||||||
|
|
@ -67,7 +67,7 @@ PROJECT_LOGO = /home/amr/Pictures/frznchess_pawn_30.png
|
||||||
# when the HTML document is shown. Doxygen will copy the logo to the output
|
# when the HTML document is shown. Doxygen will copy the logo to the output
|
||||||
# directory.
|
# directory.
|
||||||
|
|
||||||
PROJECT_ICON =
|
PROJECT_ICON = ../../Pictures/frznchess_pawn_30.png
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||||
# into which the generated documentation will be written. If a relative path is
|
# into which the generated documentation will be written. If a relative path is
|
||||||
|
|
@ -534,7 +534,7 @@ TIMESTAMP = DATETIME
|
||||||
# normally produced when WARNINGS is set to YES.
|
# normally produced when WARNINGS is set to YES.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_ALL = YES
|
EXTRACT_ALL = NO
|
||||||
|
|
||||||
# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
|
# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
|
||||||
# be included in the documentation.
|
# be included in the documentation.
|
||||||
|
|
@ -991,7 +991,8 @@ WARN_LOGFILE =
|
||||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||||
# Note: If this tag is empty the current directory is searched.
|
# Note: If this tag is empty the current directory is searched.
|
||||||
|
|
||||||
INPUT = /home/amr/MPLABXProjects/chessmcu.X
|
INPUT = "./README.md ./" \
|
||||||
|
/home/amr/MPLABXProjects/chessmcu.X
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses
|
# that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses
|
||||||
|
|
@ -1456,7 +1457,8 @@ 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 = doxygen-awesome-css/doxygen-awesome.css
|
HTML_EXTRA_STYLESHEET = doxygen-awesome-css/doxygen-awesome.css \
|
||||||
|
doxygen-awesome-css/doxygen-awesome-sidebar-only.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
|
||||||
|
|
@ -1490,7 +1492,7 @@ HTML_COLORSTYLE = LIGHT
|
||||||
# Minimum value: 0, maximum value: 359, default value: 220.
|
# Minimum value: 0, maximum value: 359, default value: 220.
|
||||||
# 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_HUE = 249
|
HTML_COLORSTYLE_HUE = 208
|
||||||
|
|
||||||
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
|
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
|
||||||
# in the HTML output. For a value of 0 the output will use gray-scales only. A
|
# in the HTML output. For a value of 0 the output will use gray-scales only. A
|
||||||
|
|
@ -1498,7 +1500,7 @@ HTML_COLORSTYLE_HUE = 249
|
||||||
# Minimum value: 0, maximum value: 255, default value: 100.
|
# Minimum value: 0, maximum value: 255, default value: 100.
|
||||||
# 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_SAT = 64
|
HTML_COLORSTYLE_SAT = 158
|
||||||
|
|
||||||
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
|
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
|
||||||
# luminance component of the colors in the HTML output. Values below 100
|
# luminance component of the colors in the HTML output. Values below 100
|
||||||
|
|
@ -1851,7 +1853,7 @@ SHOW_ENUM_VALUES = NO
|
||||||
# Minimum value: 0, maximum value: 1500, default value: 250.
|
# Minimum value: 0, maximum value: 1500, default value: 250.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
TREEVIEW_WIDTH = 250
|
TREEVIEW_WIDTH = 600
|
||||||
|
|
||||||
# If the EXT_LINKS_IN_WINDOW option is set to YES, Doxygen will open links to
|
# If the EXT_LINKS_IN_WINDOW option is set to YES, Doxygen will open links to
|
||||||
# external symbols imported via tag files in a separate window.
|
# external symbols imported via tag files in a separate window.
|
||||||
|
|
@ -1902,7 +1904,7 @@ FORMULA_MACROFILE =
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
USE_MATHJAX = NO
|
USE_MATHJAX = YES
|
||||||
|
|
||||||
# With MATHJAX_VERSION it is possible to specify the MathJax version to be used.
|
# With MATHJAX_VERSION it is possible to specify the MathJax version to be used.
|
||||||
# Note that the different versions of MathJax have different requirements with
|
# Note that the different versions of MathJax have different requirements with
|
||||||
|
|
@ -1913,7 +1915,7 @@ USE_MATHJAX = NO
|
||||||
# The default value is: MathJax_2.
|
# The default value is: MathJax_2.
|
||||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||||
|
|
||||||
MATHJAX_VERSION = MathJax_2
|
MATHJAX_VERSION = MathJax_3
|
||||||
|
|
||||||
# When MathJax is enabled you can set the default output format to be used for
|
# When MathJax is enabled you can set the default output format to be used for
|
||||||
# the MathJax output. For more details about the output format see MathJax
|
# the MathJax output. For more details about the output format see MathJax
|
||||||
|
|
@ -2247,7 +2249,7 @@ LATEX_EMOJI_DIRECTORY =
|
||||||
# readers/editors.
|
# readers/editors.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
GENERATE_RTF = YES
|
GENERATE_RTF = NO
|
||||||
|
|
||||||
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
|
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
|
||||||
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ struct Square;
|
||||||
*/
|
*/
|
||||||
class Board {
|
class Board {
|
||||||
private:
|
private:
|
||||||
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; /**< This holds the game state.
|
||||||
|
* It is a 2D vector of Piece types, or nullptr for empty squares
|
||||||
|
* @image html boardGrid.svg "Logical diagram of boardGrid vector" */
|
||||||
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
|
||||||
|
|
@ -108,15 +110,59 @@ class Board {
|
||||||
return at(sq) == nullptr;
|
return at(sq) == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** A function to setup the initial board
|
||||||
|
*
|
||||||
|
* This initializes the boardGrid with the black and white pieces
|
||||||
|
* in their normal starting positions. All empty squares are set
|
||||||
|
* to nullptr.
|
||||||
|
*/
|
||||||
void setupInitialPosition();
|
void setupInitialPosition();
|
||||||
|
/** This function sets the entire board to nullptr
|
||||||
|
*
|
||||||
|
* This should, if I understand correctly, destroy
|
||||||
|
* all the Piece instances that existed because they will no longer
|
||||||
|
* have any owners, and smart pointers should auto destruct.
|
||||||
|
*/
|
||||||
void clearBoard();
|
void clearBoard();
|
||||||
|
/** This does the actual moving of a piece from one square to another
|
||||||
|
*
|
||||||
|
* Beware! This function does \e not validate if the move is legal. It
|
||||||
|
* will simply do whatever it is told to do. So only call this once you
|
||||||
|
* are positive the move is legal.
|
||||||
|
* Moves to an empty square are simple, just move the Piece to that other
|
||||||
|
* square. Captures have to also take note of the piece type captured
|
||||||
|
* and add it to the total captured by that side. This should also destroy
|
||||||
|
* the smart pointer automatically.
|
||||||
|
* @param from The originating square for the Piece that is moving
|
||||||
|
* @param to And of course, where it will end up
|
||||||
|
*/
|
||||||
void movePiece(Square from, Square to);
|
void movePiece(Square from, Square to);
|
||||||
void nextTurn();
|
void nextTurn();
|
||||||
|
/** This function takes a standard FEN string and sets up the board.
|
||||||
|
*
|
||||||
|
* FEN is a standard notation that describes only an exact position and
|
||||||
|
* other important things like whose turn it is, whether sides can castle,
|
||||||
|
* but it does \e not include the move history of the game. This makes it
|
||||||
|
* a simpler format for sharing particular interesting positions.
|
||||||
|
*
|
||||||
|
* @param strFEN A std::string that contains a valid FEN position
|
||||||
|
* @return 0 on success, -1 if the FEN string is invalid
|
||||||
|
*/
|
||||||
int setupFromFEN(std::string strFEN);
|
int setupFromFEN(std::string strFEN);
|
||||||
bool isInBounds(Square square) const;
|
bool isInBounds(Square square) const;
|
||||||
// serial shift register stuff
|
// serial shift register stuff
|
||||||
uint64_t serialBoard = 0xFFFF00000000FFFF; // opening position
|
uint64_t serialBoard = 0xFFFF00000000FFFF; // opening position
|
||||||
|
/** This takes an incoming serial stream and detects if anything has moved.
|
||||||
|
*
|
||||||
|
* The input is one bit per piece, so it can only detect the presence or
|
||||||
|
* absence of pieces on any particular square. This is the crux of our design,
|
||||||
|
* using simpler reed switches for detection instead of RFID or any other two-way
|
||||||
|
* communication with the pieces. This moves a lot of the complexity into software,
|
||||||
|
* though a lot of the complexity is actually quite easy to deal with from a software
|
||||||
|
* point of view.
|
||||||
|
*
|
||||||
|
* @param incomingBoard A 64-bit value, representing 1 bit per piece.
|
||||||
|
*/
|
||||||
void deserializeBoard(uint64_t incomingBoard);
|
void deserializeBoard(uint64_t incomingBoard);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue