Created
July 27, 2019 11:15
-
-
Save BMU-Verlag/07232c56ba0564e8786eb85cda033804 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Button_Click(object sender, EventArgs e) | |
{ | |
var button = (Button)sender; | |
int column = Grid.GetColumn(button); | |
int row = Grid.GetRow(button); | |
if (gameActive && fields[column][row] == Player.None) | |
{ | |
var currentSymbol = ""; | |
if (currentPlayer == Player.Player1) | |
{ | |
currentSymbol = "X"; | |
} | |
else | |
{ | |
currentSymbol = "O"; | |
} | |
button.Content = currentSymbol; | |
fields[column][row] = currentPlayer; | |
if (currentPlayer == Player.Player1) | |
{ | |
currentPlayer = Player.Player2; | |
GameInformation.Content = "O ist am Zug"; | |
} | |
else | |
{ | |
currentPlayer = Player.Player1; | |
GameInformation.Content = "X ist am Zug"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment