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

51 lines
1.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QwirkleClassLibrary
{
public class Board
{
private List<Cell> Cells;
public Board()
{
Console.WriteLine("BOARD created !");
Cells = new List<Cell>();
for (int i = 0; i < 12; i++)
{
for (int j = 0; j < 12; j++)
{
var localcell = new Cell(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].SetTile(tile) == true)
{
return true;
}
else
{
Console.WriteLine("Please enter new coordinates for the cell where you want to place your tile.");
return false;
}
}
}
Console.WriteLine("The cell you're searching for doesn't exist. PLease enter new coordinates for the cell where you want to place your tile.");
return false;
}
}
}