|
|
@ -70,14 +70,21 @@ static void AddTile(Game game)
|
|
|
|
int x = Convert.ToInt32(ReadLine());
|
|
|
|
int x = Convert.ToInt32(ReadLine());
|
|
|
|
Write("Enter the y of the cell : ");
|
|
|
|
Write("Enter the y of the cell : ");
|
|
|
|
int y = Convert.ToInt32(ReadLine());
|
|
|
|
int y = Convert.ToInt32(ReadLine());
|
|
|
|
|
|
|
|
|
|
|
|
if (game.PlaceTile(game.GetPlayingPlayer(), tile, x, y) == true)
|
|
|
|
if (game.IsMoveCorrect(tile, x, y, game.GetBoard()) == true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WriteLine("ok ! your tile is placed");
|
|
|
|
if (game.PlaceTile(game.GetPlayingPlayer(), tile, x, y) == true)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
WriteLine("ok ! your tile is placed");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
WriteLine("ERROR : Cell already used");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WriteLine("ERROR : Cell already used");
|
|
|
|
WriteLine("ERROR : Move not correct");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -156,9 +163,9 @@ static void ShowBoard(Game game)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for(int y=0; y<board.Columns; y++)
|
|
|
|
for(int y=0; y<board.Columns; y++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(board.GetCell(i, y).IsFree == false)
|
|
|
|
if(board.GetCell(i, y)!.IsFree == false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Tile tile = board.GetCell(i, y).GetTile;
|
|
|
|
Tile? tile = board.GetCell(i, y)?.GetTile;
|
|
|
|
Console.Write("| " + tile.GetShape.ToString()[0] + tile.GetShape.ToString()[1] + tile.GetColor.ToString()[0] + " |");
|
|
|
|
Console.Write("| " + tile.GetShape.ToString()[0] + tile.GetShape.ToString()[1] + tile.GetColor.ToString()[0] + " |");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|