Ejemplo n.º 1
0
        public void testSimpleHorizontalAttack()
        {
            XYLocation loc = new XYLocation(0, 0);

            board.addQueenAt(loc);
            Assert.AreEqual(0, board.getNumberOfAttacksOn(loc));
            Assert.AreEqual(1, board.getNumberOfAttacksOn(new XYLocation(1, 0)));
            Assert.AreEqual(1, board.getNumberOfAttacksOn(loc.Right()));
            Assert.AreEqual(1, board.getNumberOfAttacksOn(new XYLocation(7, 0)));
        }
Ejemplo n.º 2
0
        public void testMultipleQueens()
        {
            XYLocation loc1 = new XYLocation(3, 3);

            board.addQueenAt(loc1);
            Assert.AreEqual(1, board.getNumberOfAttacksOn(loc1.Right()));

            board.addQueenAt(loc1.Right().Right());
            Assert.AreEqual(1, board.getNumberOfAttacksOn(loc1));
            Assert.AreEqual(2, board.getNumberOfAttacksOn(loc1.Right()));

            board.addQueenAt(loc1.Right().Down());
            Assert.AreEqual(2, board.getNumberOfAttacksOn(loc1));
            Assert.AreEqual(3, board.getNumberOfAttacksOn(loc1.Right()));
            Assert.AreEqual(2, board.getNumberOfAttacksOn(loc1.Right().Right()));
        }