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/Boards/Cell.cs

56 lines
918 B

// ReSharper disable All
using System.Runtime.CompilerServices;
using QwirkleClassLibrary.Tiles;
namespace QwirkleClassLibrary.Boards;
public class Cell
{
private readonly int x;
private readonly int y;
private Tile? tile = null;
public Cell(int x, int y)
{
if (x < 0 || y < 0)
{
throw new ArgumentException(x.ToString() + y.ToString());
}
this.x = x;
this.y = y;
}
public int GetX
{
get { return x; }
}
public int GetY
{
get { return y; }
}
public bool IsFree
{
get { return tile == null; }
}
public Tile? GetTile
{
get { return tile; }
}
public bool SetTile(Tile addedTile)
{
if (tile == null)
{
tile = addedTile;
return true;
}
else
{
return false;
}
}
}