Example #1
0
        public PicrossBoard(PicrossBoard copySource)
        {
            Puzzle      = copySource.Puzzle;
            RowCount    = Puzzle.RowCount;
            ColumnCount = Puzzle.ColumnCount;

            Matrix = new PicrossCell[RowCount, ColumnCount];
            for (int rowIndex = 0; rowIndex < RowCount; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < ColumnCount; columnIndex++)
                {
                    PicrossCell otherCell = copySource.Matrix[rowIndex, columnIndex];
                    Matrix[rowIndex, columnIndex] = new PicrossCell()
                    {
                        State  = otherCell.State,
                        Row    = rowIndex,
                        Column = columnIndex
                    };
                }
            }

            Columns     = CopyColumns(copySource);
            Rows        = CopyRows(copySource);
            ActiveLines = (new[] { Columns, Rows }).SelectMany(collection => collection);
        }
Example #2
0
 public PicrossLine(PicrossLine copySource)
 {
     Cells = new PicrossCell[copySource.Length];
     for (int i = 0; i < Length; i++)
     {
         Cells[i] = new PicrossCell()
         {
             State = copySource.Cells[i].State
         };
     }
 }
Example #3
0
        public PicrossLine(int length, PicrossCellState state)
        {
            var cells = new PicrossCell[length];

            for (int i = 0; i < length; i++)
            {
                cells[i] = new PicrossCell()
                {
                    State = state
                };
            }
            Cells = cells;
        }
Example #4
0
        public PicrossLine(IEnumerable <PicrossCellState> cellStates)
        {
            Cells = new PicrossCell[cellStates.Count()];
            int i = 0;

            foreach (var cellState in cellStates)
            {
                Cells[i] = new PicrossCell()
                {
                    State = cellState
                };
                i++;
            }
        }
Example #5
0
        public void Copy(PicrossBoard source)
        {
            if (Puzzle != source.Puzzle)
            {
                throw new ArgumentException();
            }

            for (int rowIndex = 0; rowIndex < RowCount; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < ColumnCount; columnIndex++)
                {
                    PicrossCell otherCell = source.Matrix[rowIndex, columnIndex];
                    Matrix[rowIndex, columnIndex].State = otherCell.State;
                }
            }
        }
Example #6
0
        public PicrossBoard(PicrossPuzzle puzzle)
        {
            Puzzle = puzzle;

            RowCount    = Puzzle.RowCount;
            ColumnCount = Puzzle.ColumnCount;

            Matrix = new PicrossCell[RowCount, ColumnCount];
            for (int rowIndex = 0; rowIndex < RowCount; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < ColumnCount; columnIndex++)
                {
                    Matrix[rowIndex, columnIndex] = new PicrossCell()
                    {
                        Row    = rowIndex,
                        Column = columnIndex
                    };
                }
            }

            Columns     = GatherColumns();
            Rows        = GatherRows();
            ActiveLines = (new[] { Columns, Rows }).SelectMany(collection => collection);
        }