diff options
author | zedarider <ymherklotz@gmail.com> | 2017-01-17 15:48:32 +0000 |
---|---|---|
committer | zedarider <ymherklotz@gmail.com> | 2017-01-17 15:48:32 +0000 |
commit | 9a457557caed9ef614456a9c8139c89084381ed3 (patch) | |
tree | ad3a9ccedc064a70b7981197a8a91795bbaeacb6 | |
parent | f0799aef3ff8c4a8e8ffea79c963b8f128c462b9 (diff) | |
download | ChessAI-9a457557caed9ef614456a9c8139c89084381ed3.tar.gz ChessAI-9a457557caed9ef614456a9c8139c89084381ed3.zip |
made it more readable
-rw-r--r-- | include/chess_board.hpp | 6 | ||||
-rw-r--r-- | include/chess_piece.hpp | 4 | ||||
-rw-r--r-- | src/chess_board.cpp | 7 |
3 files changed, 11 insertions, 6 deletions
diff --git a/include/chess_board.hpp b/include/chess_board.hpp index c277618..ac96323 100644 --- a/include/chess_board.hpp +++ b/include/chess_board.hpp @@ -28,11 +28,11 @@ class ChessBoard { public: ChessBoard(); - void populateBoard(); - void printBoard(); + bool populateBoard(); + bool printBoard(); protected: private: - static const unsigned BOARD_SIZE = 64; + static const std::size_t BOARD_SIZE = 64; boardVector board; }; diff --git a/include/chess_piece.hpp b/include/chess_piece.hpp index e7f2f79..5b2c1c2 100644 --- a/include/chess_piece.hpp +++ b/include/chess_piece.hpp @@ -30,6 +30,8 @@ class Knight; class Pawn; class EmptyPiece; +typedef unsigned int boardPosition; + // Colour enum class so that we can have the colours in the Chess Piece and not // using normal enums because of undefined errors @@ -54,7 +56,7 @@ public: protected: // current location of the piece which is protected as it can still be // inherited by the piece classes - int m_x, m_y; + boardPosition m_x, m_y; // defines what colour the piece is Colour m_colour; diff --git a/src/chess_board.cpp b/src/chess_board.cpp index 3432b52..051decd 100644 --- a/src/chess_board.cpp +++ b/src/chess_board.cpp @@ -22,12 +22,13 @@ ChessBoard::ChessBoard() { board.emplace_back(new EmptyPiece); } -void ChessBoard::populateBoard() { +bool ChessBoard::populateBoard() { for(auto&& piece : board) piece = chessPiecePtr(new Knight); + return true; } -void ChessBoard::printBoard() { +bool ChessBoard::printBoard() { int i = 0; for(auto&& piece : board) { @@ -35,4 +36,6 @@ void ChessBoard::printBoard() { piece->move(1, 2); ++i; } + + return true; } |