|
|
@ -9,33 +9,32 @@ namespace QwirkleClassLibrary
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class Board
|
|
|
|
public class Board
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private List<Cell> Cells;
|
|
|
|
private List<Cell> cells;
|
|
|
|
public IReadOnlyCollection<Cell> ReadCells { get; private set; }
|
|
|
|
public IReadOnlyCollection<Cell> ReadCells { get; private set; }
|
|
|
|
// ReadCells = Cells.AsReadOnly;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Board()
|
|
|
|
public Board()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Cells = new List<Cell>();
|
|
|
|
cells = new List<Cell>();
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int j = 0; j < 12; j++)
|
|
|
|
for (int j = 0; j < 12; j++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Cell localcell = new(i, j);
|
|
|
|
Cell localcell = new(i, j);
|
|
|
|
Cells.Add(localcell);
|
|
|
|
cells.Add(localcell);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool AddTileInCell(int x, int y, Tile tile)
|
|
|
|
public bool AddTileInCell(int x, int y, Tile tile)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int i = 0; i < Cells.Count; i++)
|
|
|
|
for (int i = 0; i < cells.Count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (this.Cells[i].GetX == x && this.Cells[i].GetY == y)
|
|
|
|
if (this.cells[i].GetX == x && this.cells[i].GetY == y)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Cells[i].IsFree == true)
|
|
|
|
if (cells[i].IsFree == true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Cells[i].SetTile(tile);
|
|
|
|
return cells[i].SetTile(tile);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|