diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | include/chess_ai.hpp | 30 |
2 files changed, 19 insertions, 15 deletions
@@ -7,7 +7,11 @@ TARGET := bin/chess_ai SRCEXT := cpp SOURCES := $(shell find $(SRCDIR) -type f -name "*.$(SRCEXT)") OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o)) +<<<<<<< HEAD +CFLAGS := -g -Wall -Wextra -std=c++14 +======= CFLAGS := -g -Wall -Wextra -Wpedantic -std=c++14 +>>>>>>> 95f75aa7aacf5e0e1ef11e8d200f84de44bd891f LIB := INC := -I include diff --git a/include/chess_ai.hpp b/include/chess_ai.hpp index fc05b2a..3a0d95b 100644 --- a/include/chess_ai.hpp +++ b/include/chess_ai.hpp @@ -3,24 +3,24 @@ #define CHESS_BOARD_SIZE 8 -#include <vector> #include <iostream> +#include <vector> #include <string> namespace chess_ai { // Describes the different types of chess pieces there are on the board enum piece_type : unsigned; - + // Describes the colour of the pieces enum piece_colour : unsigned; - + // just describes if the board is full or empty enum board_state : unsigned; // defines the errors that can happen when moving a piece enum move_error : unsigned; - + // The chess board that will be played on class chess_board; @@ -28,10 +28,10 @@ namespace chess_ai { class chess_piece; // typedefs for iterators to access elements easier - + typedef std::vector<std::vector<chess_ai::chess_piece>>:: iterator vector_iterator; - + typedef std::vector<chess_ai::chess_piece>::iterator square_iterator; enum piece_type : unsigned { @@ -115,7 +115,7 @@ namespace chess_ai { // destructor to clean up the variables ~chess_board(); - + // prints the current board state void print_board(); @@ -137,7 +137,7 @@ namespace chess_ai { // moves a piece to an x, y coordinate move_error move_piece(chess_piece piece, unsigned x, unsigned y); - + // move piece with x and y as original and final destination move_error move_piece(unsigned orig_x, unsigned orig_y, unsigned dest_x, unsigned dest_y); @@ -151,7 +151,7 @@ namespace chess_ai { square_iterator& iterate_board(square_iterator& it, unsigned x, unsigned y); - + private: // initialises vector @@ -160,7 +160,7 @@ namespace chess_ai { // moves the pawn and tests all the cases that it should. move_error move_pawn(square_iterator it, square_iterator new_it, chess_piece& taken_piece); - + // The size of the chess board is a constant and hence defined by a // preprocessed define statement. const unsigned SIZE; @@ -172,8 +172,8 @@ namespace chess_ai { class chess_piece { friend class chess_board; public: - - // Initialises the chess piece to an empty square on the board + + // Initialises the chess piece to an empty square on the board chess_piece() : type(empty), colour(none), x(0), y(0) {} // Otherwise initialise the chess piece to a king or queen where the @@ -204,7 +204,7 @@ namespace chess_ai { // return a printable version of the square std::string str(); - + private: // Type of the chess piece, eg. bishop or queen @@ -212,10 +212,10 @@ namespace chess_ai { // Colour of the chess piece piece_colour colour; - + // x location of the chess piece unsigned x; - + // y location of the chess piece unsigned y; }; |