Esempio n. 1
0
        public MoveScore MakeMove(IMove move, Player p)
        {
            List <Box> results   = SpeculateMove(move, p);
            bool       foundSlot = false;

            foreach (Move m in AvailableMoves)
            {
                if (move.CompareTo(m) == 0)
                {
                    m.SetPlayer(p);
                    AvailableMoves.Remove(m);
                    Moves.Add(m);
                    foundSlot = true;
                    break;
                }
            }

            System.Diagnostics.Debug.Assert(foundSlot);

            MoveScore score = MoveScore.Zero;

            if (results.Count > 0)
            {
                foreach (Box b in results)
                {
                    m_Boxes.Add(b);
                    score = BumpScore(score);
                }

                p.AddScore(results.Count);
            }

            return(score);
        }