Пример #1
0
 public TeeBoardState(TeeBoardState state, TeeMove move)
 {
     StartHole = state.StartHole;
     Board = state.Board.ToArray();
     History = state.History.ToList();
     apply(move);
 }
Пример #2
0
 private List<TeeBoardState> findSolution(TeeBoardState state)
 {
     var newStates = TeeMove.GetAll()
         .Select(x => makeMoveIfPossible(state, x))
         .Where(x => x != null)
         .ToList();
     if (state.History.Count > 11)
     {
         return newStates;
     }
     return newStates.SelectMany(findSolution).ToList();
 }
Пример #3
0
        private TeeBoardState makeMoveIfPossible(TeeBoardState from, TeeMove move)
        {
            _tries++;
            if (_tries%100000 == 0)
            {
                Console.WriteLine($"Tries {_tries}");
            }

            if (!from.CanBeApplied(move))
            {
                return null;
            }
            return new TeeBoardState(from, move);
        }