From 018054276f57e1d7f0957689aa84b40f076c6ec5 Mon Sep 17 00:00:00 2001 From: Felix Detig Date: Sat, 12 Feb 2022 01:05:49 +0100 Subject: [PATCH] Refactored TicTacToeBrett.Set --- .../MiniGames/Shared/Models/TicTacToeBrett.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs index 46142a5..48a6800 100644 --- a/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs +++ b/BlazorSolution/MiniGames/Shared/Models/TicTacToeBrett.cs @@ -47,20 +47,21 @@ namespace MiniGames.Shared.Models { int x = pos / 3; int y = pos % 3; - + try { - if (Felder[x, y] != LEER) - return false; + if (Felder[x, y] == LEER) + { + Felder[x, y] = wert; + return true; + } } catch (IndexOutOfRangeException e) { - return false; + // absichtlich leer } - Felder[x, y] = wert; - - return true; + return false; } public bool Voll()