Browse Source

Refactored TicTacToeBrett.Gewinner

feature/tictactoe
Felix Detig 3 years ago
parent
commit
cab4394752
  1. 10
      BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs

10
BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs

@ -82,14 +82,12 @@ namespace MiniGames.Shared.Models
public int Gewinner() public int Gewinner()
{ {
if (Felder[0, 0] == Felder[0, 1] && Felder[0, 1] == Felder[0, 2] && Felder[0, 0] != LEER)
for (int i = 0; i < 3; i++)
{ {
return Felder[0, 0];
}
if (Felder[1, 0] == Felder[1, 1] && Felder[1, 1] == Felder[1, 2] && Felder[1, 0] != LEER)
if (Felder[i, 0] == Felder[i, 1] && Felder[i, 1] == Felder[i, 2] && Felder[i, 0] != LEER)
{ {
return Felder[1, 0];
return Felder[i, 0];
}
} }
return LEER; return LEER;

Loading…
Cancel
Save