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)
{
while(player.Tiles.Count < 6)
{ {
if (bag.TilesBag.Count < 6) if (bag.TilesBag.Count == 0)
{ {
return false; return false;
} }
for (int i = 0; i < player.Tiles.Count; i++) int val = RandomNumberGenerator.GetInt32(0, bag.TilesBag.Count);
{
Random random = new Random();
int val = random.Next(0, bag.TilesBag.Count);
player.AddTileToPlayer(bag.TilesBag[val]); player.AddTileToPlayer(bag.TilesBag[val]);
bag.RemoveTileInBag(bag.TilesBag[val]); bag.RemoveTileInBag(bag.TilesBag[val]);
@ -148,9 +147,9 @@ namespace QwirkleClassLibrary
return true; 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 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