Browse Source

Refactored TicTacToeBrett.Gleich und TicTacToeBrett.Voll

feature/tictactoe
Felix Detig 3 years ago
parent
commit
3944a6cfb1
  1. 19
      BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs

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

@ -8,6 +8,11 @@ namespace MiniGames.Shared.Models
int[,] Felder;
public int Groesse
{
get { return Felder.GetLength(0) * Felder.GetLength(1); }
}
public TicTacToeBrett()
{
Felder = new[,]
@ -45,16 +50,13 @@ namespace MiniGames.Shared.Models
public bool Gleich(TicTacToeBrett anderes)
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
for (int i = 0; i < Groesse; i++)
{
if (Felder[i, j] != anderes.Felder[i, j])
if (Get(i) != anderes.Get(i))
{
return false;
}
}
}
return true;
}
@ -90,16 +92,13 @@ namespace MiniGames.Shared.Models
public bool Voll()
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
for (int i = 0; i < Groesse; i++)
{
if (Felder[i, j] == LEER)
if (Get(i) == LEER)
{
return false;
}
}
}
return true;
}

Loading…
Cancel
Save