diff --git a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs index a340ddd..1930005 100644 --- a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs +++ b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs @@ -8,15 +8,17 @@ namespace MiniGames.Shared.Models { public class TicTacToeBrett { + public const int LEER = -1; + int[,] Felder; public TicTacToeBrett() { Felder = new[,] { - { -1, -1, -1 }, - { -1, -1, -1 }, - { -1, -1, -1 }, + { LEER, LEER, LEER }, + { LEER, LEER, LEER }, + { LEER, LEER, LEER }, }; } @@ -48,7 +50,7 @@ namespace MiniGames.Shared.Models try { - if (Felder[x, y] != -1) + if (Felder[x, y] != LEER) return false; } catch (IndexOutOfRangeException e) @@ -67,7 +69,7 @@ namespace MiniGames.Shared.Models { for (int j = 0; j < 3; j++) { - if (Felder[i, j] == -1) + if (Felder[i, j] == LEER) { return false; } diff --git a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs b/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs index 9b93890..27d8f31 100644 --- a/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs +++ b/BlazorSolution/MiniGamesTests/TicTacToeBrettTest.cs @@ -6,9 +6,9 @@ namespace MiniGamesTests public class TicTacToeBrettTest { public TicTacToeBrett TestBrett( - int a = -1, int b = -1, int c = -1, - int d = -1, int e = -1, int f = -1, - int g = -1, int h = -1, int i = -1 + int a = TicTacToeBrett.LEER, int b = TicTacToeBrett.LEER, int c = TicTacToeBrett.LEER, + int d = TicTacToeBrett.LEER, int e = TicTacToeBrett.LEER, int f = TicTacToeBrett.LEER, + int g = TicTacToeBrett.LEER, int h = TicTacToeBrett.LEER, int i = TicTacToeBrett.LEER ) { return new( @@ -26,7 +26,13 @@ namespace MiniGamesTests { // arrange TicTacToeBrett brett = new(); - TicTacToeBrett erwartetesBrett = TestBrett(-1, -1, -1, -1, 0); + TicTacToeBrett erwartetesBrett = TestBrett( + TicTacToeBrett.LEER, + TicTacToeBrett.LEER, + TicTacToeBrett.LEER, + TicTacToeBrett.LEER, + 0 + ); int pos = 4; int wert = 0; bool erwartetGesetzt = true;