private Boolean checkEndGame() { GameStatus status = logic.getGameStatus(); if (status == GameStatus.BLACKWINS) { WhoseTurn.Text = "Black player wins!"; System.Diagnostics.Debug.WriteLine("game status is BLACKWINS"); return(true); } else if (status == GameStatus.REDWINS) { WhoseTurn.Text = "Red player wins!"; System.Diagnostics.Debug.WriteLine("game status is REDWINS"); return(true); } else if (status == GameStatus.DRAW) { WhoseTurn.Text = "Game is a draw."; System.Diagnostics.Debug.WriteLine("game status is DRAW"); return(true); } else { System.Diagnostics.Debug.WriteLine("game status is NOWINNER"); return(false); } }
private static double getOptimizedHeuristic(int depth, int maxDepth, GameLogic g) { if (depth == maxDepth || g.getGameStatus() != GameStatus.NOWINNER) { return(g.calculateHeuristic()); } else { PieceColor currentPlayer = g.whoseMove(); List <MoveAttempt> starting = g.getAllDoableMoveJumpAttempts(); List <List <MoveAttempt> > poss = new List <List <MoveAttempt> >(); foreach (MoveAttempt possibility in starting) { List <MoveAttempt> p = new List <MoveAttempt>(); p.Add(possibility); foreach (List <MoveAttempt> fullturn in getFullTurns(p, new GameLogic(g))) { poss.Add(fullturn); } } System.Diagnostics.Debug.WriteLine("starting length: " + starting.Count + ". poss length: " + poss.Count); } return(.345); }
private static double getOptimizedHeuristic(int depth, int maxDepth, GameLogic g) { if (depth == maxDepth || g.getGameStatus() != GameStatus.NOWINNER) { return g.calculateHeuristic(); } else { PieceColor currentPlayer = g.whoseMove(); List<MoveAttempt> starting = g.getAllDoableMoveJumpAttempts(); List<List<MoveAttempt>> poss = new List<List<MoveAttempt>>(); foreach (MoveAttempt possibility in starting) { List<MoveAttempt> p = new List<MoveAttempt>(); p.Add(possibility); foreach(List<MoveAttempt> fullturn in getFullTurns(p, new GameLogic(g))) { poss.Add(fullturn); } } System.Diagnostics.Debug.WriteLine("starting length: " + starting.Count + ". poss length: " + poss.Count); } return .345; }