You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sae201_qwirkle/Qwirkle/QwirkleClassLibrary/Board.cs

46 lines
1.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace QwirkleClassLibrary
{
public class Board
{
private List<Cell> cells;
public IReadOnlyCollection<Cell> ReadCells { get; private set; }
public Board()
{
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);
}
}
}
public bool AddTileInCell(int x, int y, Tile tile)
{
for (int i = 0; i < cells.Count; i++)
{
if (this.cells[i].GetX == x && this.cells[i].GetY == y)
{
if (cells[i].IsFree == true)
{
return cells[i].SetTile(tile);
}
}
}
return false;
}
}
}