public Direction GetDirection(GameGrid grid) { const int depth = 5; int best = 0; double howGood = double.NegativeInfinity; int count = (int)Math.Pow(4, depth); var directions = Extentions.EnumDirections().ToArray(); GameGrid[] gridsnow = new GameGrid[depth + 1]; for (int i = 0; i < count; i++) { for (int x = gridsnow.Length - Getmod(i) - 1; x < gridsnow.Length; x++) { gridsnow[x] = gridsnow[x - 1].Clone(); gridsnow[x].Swipe(); } } // drunk, fix later }
public Direction GetDirection(GameGrid grid) { return(Extentions.EnumDirections().Where(_ => grid.CanSwipe(_)) .OrderByDescending(_ => RateOpportunity(grid, _, 0)).First()); }