public override string GetLineForQuestion(CrosswordQuestion question) { int rowIndex = Array.IndexOf(_horizontalQuestions, question); if (rowIndex != -1) { return MatrixHelper.GetHorizontalLine(_field, rowIndex); } int columnIndex = Array.IndexOf(_verticalQuestions, question); if (columnIndex != -1) { return MatrixHelper.GetVerticalLine(_field, columnIndex); } return null; }
public override IReadOnlyCollection<CrosswordCell> GetCellsForQuestion(CrosswordQuestion question) { var cells = new List<CrosswordCell>(); int rowIndex = Array.IndexOf(_horizontalQuestions, question); if (rowIndex != -1) { cells.AddRange(Enumerable.Range(0, _size).Select(x => new CrosswordCell(rowIndex, x))); } int columnIndex = Array.IndexOf(_verticalQuestions, question); if (columnIndex != -1) { cells.AddRange(Enumerable.Range(0, _size).Select(x => new CrosswordCell(x, columnIndex))); } return cells; }
public abstract string GetLineForQuestion(CrosswordQuestion question);
public abstract IReadOnlyCollection<CrosswordCell> GetCellsForQuestion(CrosswordQuestion question);