private Peers GetRowPeersForValueCell(Int32 column, Int32 row) { var peers = new Peers(); /* Backtrack until a SumCell is hit. */ var startColumn = column; while (!(this._cells[--startColumn, row] is SumCell)) { ; } peers.Sum = (this._cells[startColumn, row] as SumCell).Right; /* Go forward until another SumCell or the edge of the puzzle's row is hit. */ while ((++startColumn < this._width) && !(this._cells[startColumn, row] is SumCell)) { peers.Add(this._cells[startColumn, row] as ValueCell); } return(peers); }
private Peers GetColumnPeersForValueCell(Int32 column, Int32 row) { var peers = new Peers(); /* Backtrack until a SumCell is hit. */ var startRow = row; while (!(this._cells[column, --startRow] is SumCell)) { ; } peers.Sum = (this._cells[column, startRow] as SumCell).Down; /* Go forward until another SumCell or the edge of the puzzle's column is hit. */ while ((++startRow < this._height) && !(this._cells[column, startRow] is SumCell)) { peers.Add(this._cells[column, startRow] as ValueCell); } return(peers); }