private void MoveEmptyPosToRightmostColumn() { var boundary = board.SizeInCells() - 1; while (board.GetEmptyCellPos().column < boundary) { var emptyPos = board.GetEmptyCellPos(); emptyPos.column += 1; MoveCellAccordingToRules(emptyPos); } }
private TableLayoutPanel CreateBoardLayoutPanel() { var layout = new TableLayoutPanel { RowCount = board.SizeInCells(), ColumnCount = board.SizeInCells(), Width = outputControl.Width, Height = outputControl.Height }; AddStyleToRowsAndColumns(layout); return(layout); }
private CellIndices EnforceBoardBoundariesByMirroringMove(CellIndices indices) { if (indices.column >= board.SizeInCells()) { indices.column -= 2; } if (indices.row >= board.SizeInCells()) { indices.row -= 2; } if (indices.column < 0) { indices.column += 2; } if (indices.row < 0) { indices.row += 2; } return(indices); }