From 6ae0bdde3f202233f6d0ed4ac365b40e083ace20 Mon Sep 17 00:00:00 2001 From: "jeremy.mouyon" Date: Thu, 6 Jun 2024 16:46:16 +0200 Subject: [PATCH] sorry --- Qwirkle/Files/Game.xml | 2 +- Qwirkle/QwirkleClassLibrary/Games/Game.cs | 2 +- Qwirkle/QwirkleClassLibrary/Tiles/TileBag.cs | 42 +++++++++----------- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/Qwirkle/Files/Game.xml b/Qwirkle/Files/Game.xml index b191d2f..1683161 100644 --- a/Qwirkle/Files/Game.xml +++ b/Qwirkle/Files/Game.xml @@ -1 +1 @@ -false15120001020304050607080901001101201301410RedRound11RedSquare121314151617181911011111211311420OrangeRound21OrangeSquare222324252627282921021121221321430PurpleRound31PurpleSquare323334353637383931031131231331440BlueRound41BlueSquare424344454647484941041141241341450YellowRound51525354555657585951051151251351460GreenRound6162636465666768696106116126136147071727374757677787971071171271371480818283848586878889810811812813814909192939495969798999109119129139141001011021031041051061071081091010101110121013101411011111211311411511611711811911101111111211131114falseJulesGreenSquareYellowSquaretrueJérémy430 \ No newline at end of file +false1714000102030405060708090100110120130140150161011121314151617181911011111211311411511620212223242526272829210211212213214215216303132333435363738393103113123133143153164041424344454647484941041141241341441541650515253545556575859510511512513514515516606162636465666768696106116126136146156167071727374757677787971071171271371471571680818283848586878889810811812813814815816909192939495969798999109119129139149159161001011021031041051061071081091010101110121013101410151016110111112113114115116117118119111011111112111311141115111612012112212312412512612712812912101211121212131214121512161301311321331341351361371381391310131113121313131413151316 \ No newline at end of file diff --git a/Qwirkle/QwirkleClassLibrary/Games/Game.cs b/Qwirkle/QwirkleClassLibrary/Games/Game.cs index c61d56d..a3bff6a 100644 --- a/Qwirkle/QwirkleClassLibrary/Games/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Games/Game.cs @@ -272,7 +272,7 @@ namespace QwirkleClassLibrary.Games { foreach (var p in players) { - for (int j = 0; j < 1; j++) // 6 + for (int j = 0; j < 6; j++) { if (bag != null && p.Tiles.Count < 6) { diff --git a/Qwirkle/QwirkleClassLibrary/Tiles/TileBag.cs b/Qwirkle/QwirkleClassLibrary/Tiles/TileBag.cs index 8f096dc..7e17b3a 100644 --- a/Qwirkle/QwirkleClassLibrary/Tiles/TileBag.cs +++ b/Qwirkle/QwirkleClassLibrary/Tiles/TileBag.cs @@ -13,9 +13,9 @@ namespace QwirkleClassLibrary.Tiles { [DataMember] private readonly List tiles = []; - + public ReadOnlyCollection? TilesBag { get; private set; } - + /// /// This is the constructor for the TileBag. It will create a tile of each of the possibilities among the Color and Shape Enums. @@ -24,29 +24,23 @@ namespace QwirkleClassLibrary.Tiles /// Throw an exception if the number of copies is negative (impossible) or superior to 3 (contradiction with the rules). public TileBag(int nbSet) { - /* if (nbSet < 0 || nbSet > 3) - { - throw new ArgumentException(nbSet.ToString()); - } - - for (int i = 0; i < nbSet; i++) - { - foreach (Shape s in Enum.GetValues(typeof(Shape))) - { - foreach (Color c in Enum.GetValues(typeof(Color))) - { - Tile t = new(s, c); - tiles.Add(t); - } - } - }*/ + if (nbSet < 0 || nbSet > 3) + { + throw new ArgumentException(nbSet.ToString()); + } - Tile t1 = new Tile(Shape.Club, Color.Yellow); - Tile t2 = new Tile(Shape.Round, Color.Orange); + for (int i = 0; i < nbSet; i++) + { + foreach (Shape s in Enum.GetValues(typeof(Shape))) + { + foreach (Color c in Enum.GetValues(typeof(Color))) + { + Tile t = new(s, c); + tiles.Add(t); + } + } + } - tiles.Add(t1); - tiles.Add(t2); - Init(); } @@ -76,7 +70,7 @@ namespace QwirkleClassLibrary.Tiles } return false; } - + [OnDeserialized] private void Init(StreamingContext sc = new()) {