示例#1
0
 public SearchAlgorithm(Game game)
     : base(game)
 {
     BasicMoveFinder = new BasicMoveFinder(game);
     SwapMoveFinder = new SwapMoveFinder(game);
     SearchMoveFinder = new SearchMoveFinder(game);
     ScoreCalculator = new ScoreCalculator(game);
 }
示例#2
0
 public SearchAlgorithm(Game game)
     : base(game)
 {
     BasicMoveFinder  = new BasicMoveFinder(game);
     SwapMoveFinder   = new SwapMoveFinder(game);
     SearchMoveFinder = new SearchMoveFinder(game);
     ScoreCalculator  = new ScoreCalculator(game);
 }
示例#3
0
        public void MakeMove()
        {
            Algorithm.FindMoves(Tableau);
            int    best      = -1;
            double bestScore = 0;

            for (int i = 0; i < Candidates.Count; i++)
            {
                Move move = Candidates[i];
                if (IsReversible(move))
                {
#if false
                    double score = ScoreCalculator.Calculate(move);
#else
                    double score = 0;
#endif
                    if (best == -1 || score > bestScore)
                    {
                        best      = i;
                        bestScore = score;
                    }
                }
            }
            if (best != -1)
            {
                ProcessMove(Candidates[best]);
                return;
            }

            MoveList moves = SearchMoveFinder.SearchMoves();

            for (int i = 0; i < moves.Count; i++)
            {
                Move move = moves[i];
                if (move.Type == MoveType.Basic || move.Type == MoveType.Swap)
                {
                    ProcessMove(move);
                }
                else if (move.Type == MoveType.TurnOverCard)
                {
                    // New information.
                    break;
                }
            }
        }