Exemplo n.º 1
0
        /// <summary>
        /// Constructor for a new branch
        /// </summary>
        /// <param name="last">"Parent" of this branch</param>
        /// <param name="row">The column AI tries to move</param>
        public Solution(Solution last, int row)
        {
            this.col = row;
            this.player = invertCell(last.player);
            if (!last.field.checkRow(row)) {
                Finalized = true;
                canMove = false;
                return;
            }

            field = new Field(last.field, row, player);
            this.last = last;
            CellState result = field.CheckField(row, player);
            if (result != CellState.Empty) {
                Finalized = true;
                mathWait = (player == result) ? 1 : -1;
                last.toStart(mathWait / CHANCECOEFF);//notify root branches
                if (result == player)
                    last.canMove = false;
            }
        }