From: Sam Moore Date: Thu, 2 Feb 2012 10:29:52 +0000 (+0800) Subject: Added check for rubbish move multipliers X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=037a4b52ab76fe90955d671604238e02f3e4f5a2;p=progcomp2012.git Added check for rubbish move multipliers --- diff --git a/judge/manager/stratego.cpp b/judge/manager/stratego.cpp index e142a4b..7894378 100644 --- a/judge/manager/stratego.cpp +++ b/judge/manager/stratego.cpp @@ -343,6 +343,8 @@ MovementResult Board::MovePiece(int x, int y, const Direction & direction, int m { return MovementResult(MovementResult::IMMOBILE_UNIT); } + if (multiplier < 1) + return MovementResult(MovementResult::INVALID_DIRECTION); //Don't allow moves that don't actually move forward if (multiplier > 1 && target->type != Piece::SCOUT) { return MovementResult(MovementResult::INVALID_DIRECTION); //Can only move a scout multiple times.