X-Git-Url: https://git.ucc.asn.au/?p=progcomp2013.git;a=blobdiff_plain;f=agents%2Fc%2B%2B%2Fqchess.h;h=31ab7a9735e97fd15bfbe9abe01b1dc2e7632437;hp=40b09f182b098ca00842e573051d1add2cceefab;hb=7a6c3dd98ba430b9bcdf95b7a92100cb7c0a1bbe;hpb=7518ec8d771e731d6ffbbe00b275b7e3c4b23301 diff --git a/agents/c++/qchess.h b/agents/c++/qchess.h index 40b09f1..31ab7a9 100644 --- a/agents/c++/qchess.h +++ b/agents/c++/qchess.h @@ -45,14 +45,14 @@ class Piece static const char * type2str(const Type & t); static Piece * AddPiece(std::vector & v, int x, int y, const Colour & colour, const Type & type1, const Type & type2, int type_index=-1); + static Piece * AddPiece(std::vector & v, const Piece & cpy); private: friend class Board; Piece(int x, int y, const Colour & colour, const Type & type1, const Type & type2 - , int type_index, int new_piece_index); // constructor + , int type_index); // constructor Piece(const Piece & cpy); // copy constructor - - int piece_index; // index of the piece in Board's pieces vector + }; @@ -111,8 +111,7 @@ class Board // determine if position is on the board bool Valid_position(int x, int y) {return (x >= 0 && x <= BOARD_WIDTH-1 && y >= 0 && y <= BOARD_HEIGHT-1);} - bool IsClone() const {return parent != NULL;} - void Clone_copy(Square & s); + private: Square grid[BOARD_WIDTH][BOARD_HEIGHT]; @@ -128,7 +127,7 @@ class Board Piece * white_king; Piece * black_king; - Board * parent; + // Add a move to the vector if it is valid void Move(Piece * p, int x, int y, std::vector & v);