public override (Column Column, int Row) Predict( Dictionary <string, CoordinateContainerBase> currentGameBoardState) { var availableCoords = BuildFlattenedKeys(currentGameBoardState); if (!availableCoords.Any()) { throw new ArgumentOutOfRangeException("Can't predict a coordinate when all coordinates are marked! Game should have ended by now!"); } availableCoords.Shuffle(); return(CoordinateKey.Parse(availableCoords.First())); }
protected (Column Column, int Row) PredictBySimulation( Dictionary <string, CoordinateContainerBase> currentGameBoardState) { var orderedByHighestProbability = SimulateShipsOnBoard(); if (FindNonMarkedBoxFromHighestProbability( orderedByHighestProbability, currentGameBoardState, out var foundKey)) { return(CoordinateKey.Parse(foundKey)); } // If no available box has been found after 20 simulations, fallback to random prediction return(base.PredictRandom(currentGameBoardState)); }