Esempio n. 1
0
        private void MoveEmptyPosToRightmostColumn()
        {
            var boundary = board.SizeInCells() - 1;

            while (board.GetEmptyCellPos().column < boundary)
            {
                var emptyPos = board.GetEmptyCellPos();
                emptyPos.column += 1;

                MoveCellAccordingToRules(emptyPos);
            }
        }
Esempio n. 2
0
        private TableLayoutPanel CreateBoardLayoutPanel()
        {
            var layout = new TableLayoutPanel
            {
                RowCount    = board.SizeInCells(),
                ColumnCount = board.SizeInCells(),
                Width       = outputControl.Width,
                Height      = outputControl.Height
            };

            AddStyleToRowsAndColumns(layout);
            return(layout);
        }
Esempio n. 3
0
        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);
        }