Пример #1
0
        private bool CheckMillAgainstBoard(IMill mill, ICow cow)//checks a specified possible mill against a type of cow to see if a mill has been created
        {
            bool       check = true;
            List <int> list  = mill.ToList();

            foreach (int i in list)
            {
                check = check && GetNode(i) == cow;
            }
            return(check);
        }
Пример #2
0
        public static void MillCowIsSafeIfNonMillCowsExist(IMill mill)
        {
            //TODO: You cannot kill a cow in a mill if there exists cows that are not in a mill
            int[] placements        = mill.Positions;
            int[] AllOtherPositions = Positions.Where(x => x != placements[0] && x != placements[1] && x != placements[2]).ToArray();

            foreach (int pos in AllOtherPositions)
            {
                IBoard   b   = new Board();
                ICowBox  box = new CowBox();
                IReferee r   = new Referee(b, box);

                b.Place(new Cow(-1, Color.Red), placements[0]);
                b.Place(new Cow(-1, Color.Red), placements[1]);
                b.Place(new Cow(-1, Color.Red), placements[2]);

                b.Place(new Cow(-1, Color.Red), pos);

                foreach (int des in placements)
                {
                    Assert.False(r.CanKill(Color.Blue, des));
                }
            }
        }
Пример #3
0
 public void Add(IMill mill)//adds a mill to mills
 {
     mills.Add(mill);
 }