From 2e4c82d4eceb36b7337112b4345dfcced5425f78 Mon Sep 17 00:00:00 2001 From: "jeremy.mouyon" Date: Thu, 16 May 2024 20:19:24 +0200 Subject: [PATCH] 0 FUCKIN SMELLS ! OK 0 ! 0 ! 000000000000000000000000 --- Qwirkle/QwirkleClassLibrary/Board.cs | 2 +- Qwirkle/QwirkleClassLibrary/Game.cs | 15 +++++++-------- Qwirkle/QwirkleClassLibrary/TileBag.cs | 6 ------ 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Qwirkle/QwirkleClassLibrary/Board.cs b/Qwirkle/QwirkleClassLibrary/Board.cs index 8638e00..8d48d6c 100644 --- a/Qwirkle/QwirkleClassLibrary/Board.cs +++ b/Qwirkle/QwirkleClassLibrary/Board.cs @@ -35,7 +35,7 @@ namespace QwirkleClassLibrary { foreach (var cell in cells) { - if (cell.IsFree == false) + if (!cell.IsFree) { return true; } diff --git a/Qwirkle/QwirkleClassLibrary/Game.cs b/Qwirkle/QwirkleClassLibrary/Game.cs index c3aea8c..52c5995 100644 --- a/Qwirkle/QwirkleClassLibrary/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Game.cs @@ -160,7 +160,7 @@ namespace QwirkleClassLibrary { foreach (var p in players) { - for (int j = 0; j < 6; j++) // ici pour test + for (int j = 0; j < 6; j++) { int val = RandomNumberGenerator.GetInt32(0, bag.TilesBag.Count); @@ -249,13 +249,13 @@ namespace QwirkleClassLibrary foreach (var t in tilesToSwap) { - if (player.RemoveTileToPlayer(t) == false) + if (!player.RemoveTileToPlayer(t)) { return false; } } - if (DrawTiles(player) == false) + if (!DrawTiles(player)) { return false; } @@ -374,13 +374,13 @@ namespace QwirkleClassLibrary var dx = cell.GetX - x; var dy = cell.GetY - y; - if (CheckExtendedSurroundingCells(t, x, y, dx, dy, b) == false) + if (!CheckExtendedSurroundingCells(t, x, y, dx, dy, b)) { return false; } } - if (CheckTilesInLine(cellUsed, b, x, y) == false) + if (!CheckTilesInLine(cellUsed, b, x, y)) { OnPlaceTile(new PlaceTileNotifiedEventArgs(t, "isn't on the same line as the ones previously placed !")); return false; @@ -399,7 +399,7 @@ namespace QwirkleClassLibrary } - if(scoreBoard.TryAdd(player, score) == false) + if(!scoreBoard.TryAdd(player, score)) { scoreBoard[player] += score; } @@ -435,7 +435,7 @@ namespace QwirkleClassLibrary return score; } - private int CalculateLineScore(Cell cell, int dx, int dy, Board b) + private static int CalculateLineScore(Cell cell, int dx, int dy, Board b) { int score = 0; @@ -459,7 +459,6 @@ namespace QwirkleClassLibrary { OnEndOfGame(new EndOfGameNotifiedEventArgs(player)); GameRunning = false; - //ScoreBoard.ToImmutableSortedDictionary(); return true; } } diff --git a/Qwirkle/QwirkleClassLibrary/TileBag.cs b/Qwirkle/QwirkleClassLibrary/TileBag.cs index 230a958..01ed06d 100644 --- a/Qwirkle/QwirkleClassLibrary/TileBag.cs +++ b/Qwirkle/QwirkleClassLibrary/TileBag.cs @@ -30,12 +30,6 @@ namespace QwirkleClassLibrary } } } - - - /* Tile t = new Tile(Shape.Club, Color.Red); - Tile t2 = new Tile(Shape.Shuriken, Color.Red); - tiles.Add(t); - tiles.Add(t2);*/ TilesBag = tiles.AsReadOnly(); }