diff --git a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs index d19f6e2..0fd3322 100644 --- a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs +++ b/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,14 +50,11 @@ namespace MiniGames.Shared.Models public bool Gleich(TicTacToeBrett anderes) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < Groesse; i++) { - for (int j = 0; j < 3; j++) + if (Get(i) != anderes.Get(i)) { - if (Felder[i, j] != anderes.Felder[i, j]) - { - return false; - } + return false; } } @@ -90,14 +92,11 @@ namespace MiniGames.Shared.Models public bool Voll() { - for (int i = 0; i < 3; i++) + for (int i = 0; i < Groesse; i++) { - for (int j = 0; j < 3; j++) + if (Get(i) == LEER) { - if (Felder[i, j] == LEER) - { - return false; - } + return false; } }