git.ucc.asn.au
/
progcomp2012.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added faq and Copyright notice
[progcomp2012.git]
/
judge
/
manager
/
stratego.cpp
diff --git
a/judge/manager/stratego.cpp
b/judge/manager/stratego.cpp
index
e7cf60a
..
e142a4b
100644
(file)
--- a/
judge/manager/stratego.cpp
+++ b/
judge/manager/stratego.cpp
@@
-57,6
+57,27
@@
Piece::Type Piece::GetType(char fromToken)
return Piece::BOULDER;
}
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
/**
* 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;
if (defender->type == Piece::FLAG)
{
winner = target->colour;
- return MovementResult(MovementResult::VICTORY);
+ return MovementResult(MovementResult::VICTORY
_FLAG
);
}
else if (defender->type == Piece::BOMB)
{
}
else if (defender->type == Piece::BOMB)
{
UCC
git Repository :: git.ucc.asn.au