public Move(int column, int row, MoveOrientation orientation, string word, Hand hand, Board board) { this.Column = column; this.Row = row; this.Orientation = orientation; this.Word = word; this.Hand = hand; this.Board = board; }
private static Tuple <int, int> AdvancePosition(Tuple <int, int> current, MoveOrientation orientation) { switch (orientation) { case MoveOrientation.HORIZONTAL: return(new Tuple <int, int>(current.Item1 + 1, current.Item2)); case MoveOrientation.VERTICAL: return(new Tuple <int, int>(current.Item1, current.Item2 + 1)); default: throw new ApplicationException("Unkown Orientation."); } }
private Tuple <int, int> AdvanceRowColumn(Tuple <int, int> rowColumn, MoveOrientation moveOrientation) { switch (moveOrientation) { case MoveOrientation.VERTICAL: return(new Tuple <int, int>(rowColumn.Item1 + 1, rowColumn.Item2)); case MoveOrientation.HORIZONTAL: return(new Tuple <int, int>(rowColumn.Item1, rowColumn.Item2 + 1)); default: throw new ApplicationException("Unkown Orientations."); } }
private Cell PreviousCell(Cell currentCell, MoveOrientation orientation) { switch (orientation) { case MoveOrientation.VERTICAL: if (currentCell.Row <= BOARD_START_INDEX) { return(null); } return(cells[currentCell.Row - 1][currentCell.Column]); case MoveOrientation.HORIZONTAL: if (currentCell.Column <= BOARD_START_INDEX) { return(null); } return(cells[currentCell.Row][currentCell.Column - 1]); default: throw new ApplicationException("Unexpected Orientation"); } }
private Cell NextCell(Cell currentCell, MoveOrientation orientation) { switch (orientation) { case MoveOrientation.VERTICAL: if (currentCell.Row >= BOARD_END_INDEX) { return(null); } return(cells[currentCell.Row + 1][currentCell.Column]); case MoveOrientation.HORIZONTAL: if (currentCell.Column >= BOARD_END_INDEX) { return(null); } return(cells[currentCell.Row][currentCell.Column + 1]); default: throw new ApplicationException("Unexpected Orientation"); } }
internal string GetWord(MoveOrientation orientation, Cell initialCell, char proposedLetter) { Cell startCell; Cell previousCell = initialCell; do // Move startCell to first letter in word. { startCell = previousCell; previousCell = PreviousCell(startCell, orientation); } while (previousCell != null && previousCell.Letter.HasValue); StringBuilder sb = new StringBuilder(); Cell currentCell = startCell; while (currentCell != null && (currentCell.Letter.HasValue || (currentCell.Column == initialCell.Column && currentCell.Row == initialCell.Row))) { sb.Append(currentCell.Letter ?? proposedLetter); currentCell = NextCell(currentCell, orientation); } return(sb.ToString()); }
internal MergedEventArgs(MoveOrientation orientation, int index, (int FromIndex, int ToIndex) movedCellIndexes, int matrixOrder, int mergedValue)