Example #1
0
        public void CoordsTestZero()
        {
            Coords coords = new Coords(0, 0, 1);

            Assert.AreEqual(0, coords.Row);
            Assert.AreEqual(0, coords.Col);
        }
Example #2
0
        /// <summary>
        /// Method that checks if the current cell can be moved to new position.
        /// </summary>
        /// <param name="currCell">Sell to be moved.</param>
        /// <param name="cellToBeMoveTo">New coordinates where the sell will be moved.</param>
        /// <returns>Retruns true if the operation is valid and false otherwise.</returns>
        private bool CheckNeighbours(Coords currCell, Coords cellToBeMoveTo)
        {
            bool cellsRowsMatch = currCell.Row == cellToBeMoveTo.Row;
            bool cellsColsMatch = currCell.Col == cellToBeMoveTo.Col;
            bool isLeftCell = currCell.Col == cellToBeMoveTo.Col - 1;
            bool isRightCell = currCell.Col == cellToBeMoveTo.Col + 1;
            bool isUpCell = currCell.Row == cellToBeMoveTo.Row - 1;
            bool isDownCell = currCell.Row == cellToBeMoveTo.Row + 1;

            if (cellsRowsMatch && (isLeftCell || isRightCell))
            {
                return true;
            }
            else if (cellsColsMatch && (isUpCell || isDownCell))
            {
                return true;
            }

            return false;
        }
Example #3
0
 public void CoordsTestTooBigRowAndCol()
 {
     Coords coords = new Coords(10099, 132454, 4);
 }
Example #4
0
 public void CoordsTestNegativeRow()
 {
     Coords coords = new Coords(-1, 0, 1);
 }
Example #5
0
 public void CoordsTestNegativeDimentions()
 {
     Coords coords = new Coords(1, 1, -1);
 }
Example #6
0
 public void CoordsTestNegativeCol()
 {
     Coords coords = new Coords(1, -1, 1);
 }