|
|
|
@ -34,48 +34,55 @@ static void AddPlayers(Game game)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MainMenu(Game game)
|
|
|
|
|
{
|
|
|
|
|
game.GiveTilesToPlayers();
|
|
|
|
|
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
|
|
|
WriteLine("Game is starting !");
|
|
|
|
|
Console.ResetColor();
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
static void ShowTiles(Game game)
|
|
|
|
|
{
|
|
|
|
|
string tagPlayerPlay = game.SetNextPlayer();
|
|
|
|
|
WriteLine("\n --------------------- YOUR TILES ------------------------");
|
|
|
|
|
|
|
|
|
|
WriteLine(" --------------------- GAME ! ------------------------");
|
|
|
|
|
WriteLine(tagPlayerPlay + "'s turn !");
|
|
|
|
|
var currentPlayer = game.GetPlayingPlayer();
|
|
|
|
|
|
|
|
|
|
MenuSwitch(game);
|
|
|
|
|
var stringBuilder = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
} while (game.GetPlayingPlayerPosition() != game.PlayerList.Count - 1);
|
|
|
|
|
for (int i = 0; i < currentPlayer.Tiles.Count(); i++)
|
|
|
|
|
{
|
|
|
|
|
stringBuilder.Append("[" + (i+1) + "] ");
|
|
|
|
|
stringBuilder.AppendLine(currentPlayer.Tiles[i].ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write(stringBuilder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ShowTiles(Game game)
|
|
|
|
|
static void AddTile(Game game)
|
|
|
|
|
{
|
|
|
|
|
WriteLine("\n --------------------- YOUR TILES ------------------------");
|
|
|
|
|
|
|
|
|
|
int pos = game.GetPlayingPlayerPosition();
|
|
|
|
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
|
Tile? tile = null;
|
|
|
|
|
Write("Enter the number of the tile you want to place : ");
|
|
|
|
|
int no = Convert.ToInt32(ReadLine());
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < game.PlayerList[pos].Tiles.Count(); i++)
|
|
|
|
|
while (no < 1 || no > 6)
|
|
|
|
|
{
|
|
|
|
|
stringBuilder.Append("[" + (i+1) + "] ");
|
|
|
|
|
stringBuilder.AppendLine(game.PlayerList[pos].Tiles[i].ToString());
|
|
|
|
|
Write("ERROR : Enter a number between 1 and 6 ! : ");
|
|
|
|
|
no = Convert.ToInt32(ReadLine());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write(stringBuilder);
|
|
|
|
|
tile = game.TileOfPlayerWithPos(no - 1);
|
|
|
|
|
|
|
|
|
|
Write("Enter the x of the cell: ");
|
|
|
|
|
int x = Convert.ToInt32(ReadLine());
|
|
|
|
|
Write("Enter the y of the cell : ");
|
|
|
|
|
int y = Convert.ToInt32(ReadLine());
|
|
|
|
|
|
|
|
|
|
if (game.PlaceTile(game.GetPlayingPlayer(), tile, x, y) == true)
|
|
|
|
|
{
|
|
|
|
|
WriteLine("ok ! your tile is placed");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
WriteLine("ERROR : Cell already used");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MenuSwitch(Game game)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int enter = 0;
|
|
|
|
|
|
|
|
|
|
while (enter != 3)
|
|
|
|
@ -93,48 +100,34 @@ static void MenuSwitch(Game game)
|
|
|
|
|
switch (enter)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
CaseOneAddTile(game);
|
|
|
|
|
AddTile(game);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void CaseOneAddTile(Game game)
|
|
|
|
|
static void MainMenu(Game game)
|
|
|
|
|
{
|
|
|
|
|
Tile? tile = null;
|
|
|
|
|
Write("Enter no tile : ");
|
|
|
|
|
int no = Convert.ToInt32(ReadLine());
|
|
|
|
|
game.GiveTilesToPlayers();
|
|
|
|
|
|
|
|
|
|
if (no >= 0 && no <= 5)
|
|
|
|
|
{
|
|
|
|
|
tile = game.TileOfPlayerWithPos(no+1);
|
|
|
|
|
Write("Enter x : ");
|
|
|
|
|
int x = Convert.ToInt32(ReadLine());
|
|
|
|
|
Write("Enter y : ");
|
|
|
|
|
int y = Convert.ToInt32(ReadLine());
|
|
|
|
|
if (game.PlaceTileGame(tile, x, y) == true)
|
|
|
|
|
{
|
|
|
|
|
Write("ok ! your tile is placed \n");
|
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
|
|
|
WriteLine("Game is starting !");
|
|
|
|
|
Console.ResetColor();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Write("ERROR : Cell already use \n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
Write("No is out of range\n");
|
|
|
|
|
}
|
|
|
|
|
string tagPlayerPlay = game.SetNextPlayer();
|
|
|
|
|
|
|
|
|
|
WriteLine(" --------------------- GAME ! ------------------------");
|
|
|
|
|
WriteLine(tagPlayerPlay + "'s turn !");
|
|
|
|
|
|
|
|
|
|
MenuSwitch(game);
|
|
|
|
|
|
|
|
|
|
} while (game.GetPlayingPlayerPosition() != game.PlayerList.Count - 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void MainGame()
|
|
|
|
@ -151,7 +144,6 @@ static void MainGame()
|
|
|
|
|
game.StartGame();
|
|
|
|
|
|
|
|
|
|
MainMenu(game);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainGame();
|