Ejemplo n.º 1
0
        private bool loadHistory(int index)
        {
            if (index >= 0 && index < this.History.Count && !this._scoringMode)
            {
                BasicGame historyGame = this.History[index];

                this._lastPassed = historyGame._lastPassed;

                this._spaces = new SpaceCollection(this, this.BoardSize);
                this._groups.Clear();
                foreach (Space space in historyGame.Spaces)
                {
                    Space gameSpace = this.Spaces.GetSpace(space.X, space.Y);
                    if (space.SpaceColor != Space.Color.None)
                    {
                        gameSpace.SpaceColor = space.SpaceColor;
                        this.addToGroup(gameSpace);
                    }
                }
                this._spaces.SpaceClick += _spaces_SpaceClick;

                this._capturesB = historyGame._capturesB;
                this._capturesW = historyGame._capturesW;

                this._historyIndex = index;

                this.NextMove = historyGame._nextMove;

                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public Game Copy()
        {
            Game copy = new BasicGame();

            copy._nextMove   = this._nextMove;
            copy._lastPassed = this._lastPassed;

            copy._spaces = new SpaceCollection();
            copySpaces(this._spaces, copy._spaces);
            copy._spaces.Size = (int)Math.Sqrt(this._spaces.Count);

            copy._groups = new List <SpaceCollection>();
            foreach (SpaceCollection grp in this._groups)
            {
                SpaceCollection copyGrp = new SpaceCollection();
                copySpaces(grp, copyGrp, copy._spaces);
                copy._groups.Add(copyGrp);
            }

            copy._capturesB = this._capturesB;
            copy._capturesW = this._capturesW;

            return(copy);
        }