Esempio n. 1
0
        public void GetCoordinatesTest()
        {
            var x = 10;
            var y = 10;

            SimulationContext.GetCoordinates(ref x, ref y, Direction.N);
            Assert.AreEqual(y, 9);

            x = 10;
            y = 10;
            SimulationContext.GetCoordinates(ref x, ref y, Direction.NE);
            Assert.AreEqual(x, 11);
            Assert.AreEqual(y, 9);

            x = 10;
            y = 10;
            SimulationContext.GetCoordinates(ref x, ref y, Direction.E);
            Assert.AreEqual(x, 11);

            x = 10;
            y = 10;
            SimulationContext.GetCoordinates(ref x, ref y, Direction.SE);
            Assert.AreEqual(x, 11);
            Assert.AreEqual(y, 11);

            x = 10;
            y = 10;
            SimulationContext.GetCoordinates(ref x, ref y, Direction.S);
            Assert.AreEqual(y, 11);

            x = 10;
            y = 10;
            SimulationContext.GetCoordinates(ref x, ref y, Direction.SW);
            Assert.AreEqual(x, 9);
            Assert.AreEqual(y, 11);

            x = 10;
            y = 10;
            SimulationContext.GetCoordinates(ref x, ref y, Direction.W);
            Assert.AreEqual(x, 9);

            x = 10;
            y = 10;
            SimulationContext.GetCoordinates(ref x, ref y, Direction.NW);
            Assert.AreEqual(x, 9);
            Assert.AreEqual(y, 9);

            x = 10;
            y = 10;
            SimulationContext.GetCoordinates(ref x, ref y, Direction.None);
            Assert.AreEqual(x, 10);
            Assert.AreEqual(y, 10);
        }
Esempio n. 2
0
 public bool hasTerritory(int xPos, int yPos, Direction direction)
 {
     SimulationContext.GetCoordinates(ref xPos, ref yPos, direction);
     return(hasTerritory(xPos, yPos));
 }