private void on_game_end(object sender, GameBoardEventArgs e) { // animate the cancel button from the ExitControl, then kill anim object //ContentControlActions.FadeOut(); //get the proper variables to find out who won BoardState state = e.State; int redScore, blackScore; e.Board.GetScore(state, out redScore, out blackScore); GameResult finalGameState; Dispatcher.Invoke(() => { //change the score labels HumanScoreLabel.Content = redScore; RobotScoreLabel.Content = blackScore; //set the final state if (redScore == blackScore) { finalGameState = GameResult.Tie; } else if (redScore < blackScore) { finalGameState = GameResult.Loss; } else { finalGameState = GameResult.Win; } GameComplete(finalGameState); }); }
public static Move human_move_handler(object humanplayer, GameBoardEventArgs args) { while (humanMove == Move.None) { Thread.Yield(); } Move returnMove = humanMove; humanMove = Move.None; humanTurn = false; return(returnMove); }