|
|
@ -1,13 +1,5 @@
|
|
|
|
using System;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
using System.Collections.Immutable;
|
|
|
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
using QwirkleClassLibrary.Tiles;
|
|
|
|
using QwirkleClassLibrary.Tiles;
|
|
|
|
using QwirkleClassLibrary.Boards;
|
|
|
|
using QwirkleClassLibrary.Boards;
|
|
|
@ -270,7 +262,7 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bag != null && p.Tiles.Count < 6)
|
|
|
|
if (bag != null && p.Tiles.Count < 6)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int val = RandomNumberGenerator.GetInt32(0, bag.TilesBag.Count);
|
|
|
|
int val = RandomNumberGenerator.GetInt32(0, bag.TilesBag!.Count);
|
|
|
|
|
|
|
|
|
|
|
|
p.AddTileToPlayer(bag.TilesBag[val]);
|
|
|
|
p.AddTileToPlayer(bag.TilesBag[val]);
|
|
|
|
bag.RemoveTileInBag(bag.TilesBag[val]);
|
|
|
|
bag.RemoveTileInBag(bag.TilesBag[val]);
|
|
|
@ -362,7 +354,7 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
{
|
|
|
|
{
|
|
|
|
while (player.Tiles.Count < 6)
|
|
|
|
while (player.Tiles.Count < 6)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (bag!.TilesBag.Count == 0)
|
|
|
|
if (bag!.TilesBag!.Count == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -396,7 +388,7 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (bag!.TilesBag.Count < tilesToSwap.Count)
|
|
|
|
if (bag!.TilesBag!.Count < tilesToSwap.Count)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OnSwapTiles(new SwapTilesNotifiedEventArgs("Not enough tiles in the bag to swap !"));
|
|
|
|
OnSwapTiles(new SwapTilesNotifiedEventArgs("Not enough tiles in the bag to swap !"));
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -733,7 +725,7 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<int> playerTilesBagPos = [];
|
|
|
|
List<int> playerTilesBagPos = [];
|
|
|
|
|
|
|
|
|
|
|
|
if (bag!.TilesBag.Count == 0)
|
|
|
|
if (bag!.TilesBag!.Count == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int i = 0; i < players.Count; i++)
|
|
|
|
for (int i = 0; i < players.Count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -785,7 +777,7 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<int> playerTilesBagPos = CheckTilesBag();
|
|
|
|
List<int> playerTilesBagPos = CheckTilesBag();
|
|
|
|
|
|
|
|
|
|
|
|
if (playerTilesBagPos.Count != 0 && !CheckPlacementPossibilities(playerTilesBagPos) || bag!.TilesBag.Count == 0 && players[GetPlayingPlayerPosition()].Tiles.Count==0)
|
|
|
|
if (playerTilesBagPos.Count != 0 && !CheckPlacementPossibilities(playerTilesBagPos) || bag!.TilesBag!.Count == 0 && players[GetPlayingPlayerPosition()].Tiles.Count==0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OnEndOfGame(new EndOfGameNotifiedEventArgs(player));
|
|
|
|
OnEndOfGame(new EndOfGameNotifiedEventArgs(player));
|
|
|
|
GameRunning = false;
|
|
|
|
GameRunning = false;
|
|
|
|