Exemplo n.º 1
0
        ///<summary>Copy whole level (source level)</summary>
        public void CopyFrom(SokobanLevel uSourceLevel)
        {
            //Reinitialize level
            SetSize(uSourceLevel.iXsize, uSourceLevel.iYsize);

            //Copy all cells from source
            for (int i = 0; i < uSourceLevel.iXsize; i++)
                for (int j = 0; j < uSourceLevel.iYsize; j++)
                    bCells[i, j] = uSourceLevel.bCells[i, j];
            // (Is there any memcpy-like way for this?)

            //Copy other parameters of level
            uBestMovesSolution = uSourceLevel.uBestMovesSolution;
            uBestPushesSolution = uSourceLevel.uBestPushesSolution;
            bSolved = uSourceLevel.bSolved;
            sTitle = uSourceLevel.sTitle;
            sAuthor = uSourceLevel.sAuthor;
            sComment = uSourceLevel.sComment;
        }
Exemplo n.º 2
0
        ///<summary>Update records of level with achivment sof new solution</summary>
        public void CheckSolutionForRecord(PositionStats uSolutionStats)
        {
            bSolved = true;

            if (uSolutionStats.iMoves < uBestMovesSolution.iMoves)
            {   //New best moves record
                uBestMovesSolution = uSolutionStats;
            }
            if (uSolutionStats.iPushes < uBestPushesSolution.iPushes)
            {   //New best pushes record
                uBestPushesSolution = uSolutionStats;
            }
        }