Browse Source

Refactored TicTacToeBrett.Set

feature/tictactoe
Felix Detig 3 years ago
parent
commit
018054276f
  1. 15
      BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs

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

@ -47,20 +47,21 @@ namespace MiniGames.Shared.Models
{ {
int x = pos / 3; int x = pos / 3;
int y = pos % 3; int y = pos % 3;
try try
{ {
if (Felder[x, y] != LEER)
return false;
if (Felder[x, y] == LEER)
{
Felder[x, y] = wert;
return true;
}
} }
catch (IndexOutOfRangeException e) catch (IndexOutOfRangeException e)
{ {
return false;
// absichtlich leer
} }
Felder[x, y] = wert;
return true;
return false;
} }
public bool Voll() public bool Voll()

Loading…
Cancel
Save