@ -32,8 +32,6 @@ namespace QwirkleClassLibrary.Games
private Board board = new Board ( 15 , 12 ) ;
public Board Board = > board ;
public ObservableCollection < Cell > GetCellsInBoard = > new ObservableCollection < Cell > ( board ! . GetCells ( ) ) ;
public ReadOnlyCollection < Player > PlayerList = > players . AsReadOnly ( ) ;
private readonly List < Player > players = new ( ) ;
@ -411,18 +409,18 @@ namespace QwirkleClassLibrary.Games
{
var extendedCell = b . GetCell ( x + i * dx , y + i * dy ) ;
if ( extendedCell ? . Get Tile = = null )
if ( extendedCell ? . Tile = = null )
{
break ;
}
if ( extendedCell . Get Tile. GetColor ! = tile . GetColor & & extendedCell . Get Tile. GetShape ! = tile . GetShape )
if ( extendedCell . Tile. GetColor ! = tile . GetColor & & extendedCell . Tile. GetShape ! = tile . GetShape )
{
OnPlaceTile ( new PlaceTileNotifiedEventArgs ( tile , " : Color / Shape does not match with the surrounding tiles !" ) ) ;
return false ;
}
if ( extendedCell . Get Tile. GetColor = = tile . GetColor & & extendedCell . Get Tile. GetShape = = tile . GetShape )
if ( extendedCell . Tile. GetColor = = tile . GetColor & & extendedCell . Tile. GetShape = = tile . GetShape )
{
OnPlaceTile ( new PlaceTileNotifiedEventArgs ( tile , " : Tile already placed on the same line / column !" ) ) ;
return false ;
@ -496,7 +494,7 @@ namespace QwirkleClassLibrary.Games
return true ;
}
if ( b . GetCell ( x , y ) ! . Get Tile = = null )
if ( b . GetCell ( x , y ) ! . Tile = = null )
{
OnPlaceTile ( new PlaceTileNotifiedEventArgs ( t , ": Cell already used !" ) ) ;
}
@ -511,18 +509,18 @@ namespace QwirkleClassLibrary.Games
foreach ( var cell in surroundingCells )
{
if ( cell ? . Get Tile = = null )
if ( cell ? . Tile = = null )
{
continue ;
}
if ( cell . Get Tile. GetColor ! = t . GetColor & & cell . Get Tile. GetShape ! = t . GetShape )
if ( cell . Tile. GetColor ! = t . GetColor & & cell . Tile. GetShape ! = t . GetShape )
{
OnPlaceTile ( new PlaceTileNotifiedEventArgs ( t , " : Colors / Shapes do not match with the surrounding tiles !" ) ) ;
return false ;
}
if ( cell . Get Tile. GetColor = = t . GetColor & & cell . Get Tile. GetShape = = t . GetShape )
if ( cell . Tile. GetColor = = t . GetColor & & cell . Tile. GetShape = = t . GetShape )
{
OnPlaceTile ( new PlaceTileNotifiedEventArgs ( t , " is already placed on the same line / column !" ) ) ;
@ -545,7 +543,7 @@ namespace QwirkleClassLibrary.Games
return false ;
}
if ( surroundingCells . All ( cell = > cell ? . Get Tile = = null ) )
if ( surroundingCells . All ( cell = > cell ? . Tile = = null ) )
{
OnPlaceTile ( new PlaceTileNotifiedEventArgs ( t , " : You can't place a tile that isn't adjacent to another one !" ) ) ;
return false ;
@ -641,7 +639,7 @@ namespace QwirkleClassLibrary.Games
foreach ( var adjacentCell in surroundingCells )
{
if ( adjacentCell ? . Get Tile = = null | | cellsPlayed . Contains ( adjacentCell ) | | checkedSurroundingCells . Contains ( adjacentCell ) )
if ( adjacentCell ? . Tile = = null | | cellsPlayed . Contains ( adjacentCell ) | | checkedSurroundingCells . Contains ( adjacentCell ) )
{
continue ;
}
@ -675,7 +673,7 @@ namespace QwirkleClassLibrary.Games
{
var extendedCell = b . GetCell ( cell . GetX + i * direction . Item1 , cell . GetY + i * direction . Item2 ) ;
if ( extendedCell ? . Get Tile = = null | | cellsPlayed . Contains ( extendedCell ) )
if ( extendedCell ? . Tile = = null | | cellsPlayed . Contains ( extendedCell ) )
{
break ;
}