slight changes on Board.cs, Tile.cs and TileBag.cs

test_old_branch
Jules LASCRET 12 months ago
parent 632617f509
commit d1e184f7ca

@ -9,33 +9,32 @@ namespace QwirkleClassLibrary
{
public class Board
{
private List<Cell> Cells;
private List<Cell> cells;
public IReadOnlyCollection<Cell> ReadCells { get; private set; }
// ReadCells = Cells.AsReadOnly;
public Board()
{
Cells = new List<Cell>();
cells = new List<Cell>();
for (int i = 0; i < 12; i++)
{
for (int j = 0; j < 12; j++)
{
Cell localcell = new(i, j);
Cells.Add(localcell);
cells.Add(localcell);
}
}
}
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);
}
}

@ -23,6 +23,7 @@ namespace QwirkleClassLibrary
{
return color.ToString() + shape.ToString();
}
public Shape GetShape
{
get { return this.shape; }
@ -35,7 +36,7 @@ namespace QwirkleClassLibrary
public override string ToString()
{
return shape.ToString() + color.ToString();
return color.ToString() + shape.ToString();
}
}
}

@ -27,6 +27,11 @@ namespace QwirkleClassLibrary
}
TilesBag = tiles.AsReadOnly();
}
public void AddTileInBag(Tile tile)
{
tiles.Add(tile);
}
public void RemoveTileInBag(Tile tile)
{
@ -39,6 +44,4 @@ namespace QwirkleClassLibrary
}
}
}
}
}
Loading…
Cancel
Save