示例#1
0
        public static void OnlyMoveToEmptySpace(int pos, int[] moves, Color c)
        {
            IBoard board = Substitute.For <IBoard>();

            board.Occupant(Arg.Any <int>()).Returns(new Cow(-1, c));
            IPlayer P   = Substitute.For <IPlayer>();
            ICowBox box = Substitute.For <ICowBox>();

            box.RemainingCows(Arg.Any <Color>()).Returns(12);
            IReferee r = new Referee(board, box);

            if (c == Color.Red)
            {
                foreach (int m1 in moves)
                {
                    Assert.False(r.CanMove(Color.Red, pos, m1, Phase.Moving));
                }
            }
            if (c == Color.Black)
            {
                foreach (int m2 in moves)
                {
                    Assert.True(r.CanMove(Color.Red, pos, m2, Phase.Moving));
                }
            }
        }
示例#2
0
        public bool CanPlace(Color color, int Destination, Phase currPhase)
        {
            if (currPhase == Phase.Placing)
            {
                bool hasCows     = (Box.RemainingCows(color) > 0);
                bool spaceIsFree = Board.Occupant(Destination).Color == Color.Black;

                return(hasCows && spaceIsFree);
            }
            else
            {
                return(false);
            }
        }