Esempio n. 1
0
        public void PlaceStone(int x, int y)
        {
            if (_rules.IsLegal(_board, x, y, this.NextMove))
            {
                this.AddStone(x, y, this.NextMove);

                if (this.NextMove == Space.Color.Black)
                {
                    this._capturesB += this.RemoveDeadStones(x, y);
                }
                if (this.NextMove == Space.Color.White)
                {
                    this._capturesW += this.RemoveDeadStones(x, y);
                }

                while (this._historyIndex < this.History.Count - 1)
                {
                    this.History.Remove(this.History[this.History.Count - 1]);
                }
                if (this.NextMove == Space.Color.Black)
                {
                    this.NextMove = Space.Color.White;
                }
                else
                {
                    this.NextMove = Space.Color.Black;
                }

                _lastPassed = false;

                this.History.Add((BasicGame)this.Copy());
                this._historyIndex = this.History.Count - 1;
            }
        }