Exemple #1
0
 private void apply(TeeMove move)
 {
     History.Add(move);
     Board[move.To] = Board[move.From];
     Board[move.From] = 0;
     Board[move.Kill] = 0;
 }
Exemple #2
0
 public TeeBoardState(TeeBoardState state, TeeMove move)
 {
     StartHole = state.StartHole;
     Board = state.Board.ToArray();
     History = state.History.ToList();
     apply(move);
 }
        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);
        }
Exemple #4
0
 public bool CanBeApplied(TeeMove move)
 {
     return Board[move.From] > 0 && Board[move.To] == 0 && Board[move.Kill] > 0;
 }