public Root(Board b, int d) { Count = 1; board = b; depth = d; if (depth > Deepness) { Deepness = depth; } Winner = board.Winner; Evaluation = board.Evaluate(); if (depth == 0) { List <Board> boards; boards = board.GetNearMoves(2); boards.Sort(); if (Maximize) { boards.Reverse(); } moves = new List <Root>(boards.Count); for (int i = 0; i < boards.Count; i++) { Root r = new Root(boards[i], depth + 1); if (r.Winner != Board.Brick.Empty) { if (r.Winner == board.Turn) { Winner = board.Turn; Best = r; moves = null; } } else { moves.Add(r); } } if (moves?.Count == 0) { Winner = board.Turn == Board.Brick.White ? Board.Brick.Black : Board.Brick.White; } } }