X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=judge%2Fmanager%2Fstratego.cpp;h=e142a4bd67cc3e39e51cff3d3b2e82a20476e1b2;hb=69aa3e180883a3042446f4be3bfd6f727b0c8022;hp=e7cf60ac8b50573d98d3cfce3a7961ae01852404;hpb=78293905481ab7a67e773d05350da29940a58ea6;p=progcomp2012.git diff --git a/judge/manager/stratego.cpp b/judge/manager/stratego.cpp index e7cf60a..e142a4b 100644 --- a/judge/manager/stratego.cpp +++ b/judge/manager/stratego.cpp @@ -57,6 +57,27 @@ Piece::Type Piece::GetType(char fromToken) return Piece::BOULDER; } +/** + * Gets the opposite to the indicated colour + */ +Piece::Colour Piece::OppositeColour(const Colour & colour) +{ + switch (colour) + { + case Piece::RED: + return Piece::BLUE; + break; + case Piece::BLUE: + return Piece::RED; + break; + case Piece::BOTH: + return Piece::BOTH; + break; + case Piece::NONE: + return Piece::NONE; + } +} + /** * Construct a new, empty board * @param newWidth - the width of the board @@ -375,7 +396,7 @@ MovementResult Board::MovePiece(int x, int y, const Direction & direction, int m if (defender->type == Piece::FLAG) { winner = target->colour; - return MovementResult(MovementResult::VICTORY); + return MovementResult(MovementResult::VICTORY_FLAG); } else if (defender->type == Piece::BOMB) {