Exemple #1
0
        public virtual object Clone()
        {
            BimaruGrid clonedGrid = new BimaruGrid(NumberOfRows, NumberOfColumns);

            clonedGrid.OverwriteWith(this);

            return(clonedGrid);
        }
        public void TestOverwriteWith()
        {
            var grid = new BimaruGrid(1, 2);
            var p0   = new GridPoint(0, 0);
            var p1   = new GridPoint(0, 1);

            grid[p0] = BimaruValue.SHIP_SINGLE;
            grid[p1] = BimaruValue.UNDETERMINED;

            var overwrittenGrid = new BimaruGrid(2, 3);

            overwrittenGrid.OverwriteWith(grid);

            grid.AssertEqual(overwrittenGrid);
        }