/// <summary> /// Returns a list of coordinates that contain the character letter /// </summary> /// <param name="letter">The character that we are searching the board for</param> /// <returns>Returns a list of coordinates that contain the character letter</returns> private List<Coordinate> GetCoordinatesContainingChar(char letter) { List<Coordinate> output = new List<Coordinate>(); for (int y = 0; y < _board.GetLength(); y++) { for (int x = 0; x < _board.GetLength(); x++) { if (_board.GetCharAt(x, y) == letter) { output.Add(new Coordinate(x,y)); } } } return output; }
public void TestWith1CharBoard() { List <string> lines = new List <string>(); lines.Add("A"); _board = new WordSearchBoard(lines); Assert.AreEqual(1, _board.GetLength()); }
public void TestWithSmallBoard() { List <string> lines = new List <string>(); lines.Add("A,B,C"); lines.Add("D,E,F"); lines.Add("G,H,I"); _board = new WordSearchBoard(lines); Assert.AreEqual(3, _board.GetLength()); }