Added the draw tiles method

test_old_branch
Jules LASCRET 12 months ago
parent 4bdc3eeb5d
commit ffd985a047

@ -129,17 +129,16 @@ namespace QwirkleClassLibrary
}
}
public bool SwapTiles(Player player)
public bool DrawTiles(Player player)
{
if (bag.TilesBag.Count < 6)
while(player.Tiles.Count < 6)
{
return false;
}
if (bag.TilesBag.Count == 0)
{
return false;
}
for (int i = 0; i < player.Tiles.Count; i++)
{
Random random = new Random();
int val = random.Next(0, bag.TilesBag.Count);
int val = RandomNumberGenerator.GetInt32(0, bag.TilesBag.Count);
player.AddTileToPlayer(bag.TilesBag[val]);
bag.RemoveTileInBag(bag.TilesBag[val]);
@ -148,9 +147,9 @@ namespace QwirkleClassLibrary
return true;
}
public bool DrawTile(Player player)
public bool SwapTiles(Player player)
{
return true;
return false;
}
}
}

@ -8,7 +8,7 @@ public interface IPlayer
public bool PlaceTile(Player player, Tile tile, int x, int y);
public bool SwapTiles(Player player);
public bool DrawTiles(Player player);
public bool DrawTile(Player player);
public bool SwapTiles(Player player);
}
Loading…
Cancel
Save