public List <Square> GetNeighbours(Location location) { int row = location.Row; int column = location.Column; List <Square> neighbours = new List <Square>(); if (row > 1) { neighbours.Add(Squares.At(row - 1, column)); } if (column < Configuration.Columns) { neighbours.Add(Squares.At(row, column + 1)); } if (column > 1) { neighbours.Add(Squares.At(row, column - 1)); } if (row < Configuration.Rows) { neighbours.Add(Squares.At(row + 1, column)); } return(neighbours); }