old_branch_before_remy
Jérémy Mouyon 11 months ago
parent 3678fc96f9
commit 6ae0bdde3f

File diff suppressed because one or more lines are too long

@ -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)
{

@ -13,9 +13,9 @@ namespace QwirkleClassLibrary.Tiles
{
[DataMember]
private readonly List<Tile> tiles = [];
public ReadOnlyCollection<Tile>? TilesBag { get; private set; }
/// <summary>
/// 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
/// <exception cref="ArgumentException">Throw an exception if the number of copies is negative (impossible) or superior to 3 (contradiction with the rules).</exception>
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())
{

Loading…
Cancel
Save