public static Point FindMaxMinPoint(GameManager i_Game) { int maxMinScore = 0; Point maxMinPoint = new Point(0, 0); foreach (Point Move in i_Game.AvailableMoves) { GameManager ClonedGame = i_Game.Clone(); ClonedGame.Board.MakeMove(Move, ClonedGame.ColorPlaying); ClonedGame.ColorPlaying = eCoinColor.Black; ClonedGame.UpdateAvailableMoves(); if (ClonedGame.IsThereAvailableMove()) { int minScore = FindMinMovePointScore(ClonedGame) + GetRankOfPoint(Move, i_Game.Board.SizeOfBoard); if (minScore > maxMinScore) { maxMinPoint = Move; maxMinScore = minScore; } } else { return(Move); } } return(maxMinPoint); }
private static int FindMinMovePointScore(GameManager i_Game) { int scoreOfWhiteInGame; int minScoreOfWhite = int.MaxValue; // Infinity foreach (Point MoveToCheck in i_Game.AvailableMoves) { GameManager ClonedGame = i_Game.Clone(); ClonedGame.Board.MakeMove(MoveToCheck, ClonedGame.ColorPlaying); ClonedGame.GetScoreOfUsers(out int o_unusedValue, out scoreOfWhiteInGame); if (minScoreOfWhite > scoreOfWhiteInGame) { minScoreOfWhite = scoreOfWhiteInGame; } } return(minScoreOfWhite); }