diff --git a/Qwirkle/QwirkleClassLibrary/Game.cs b/Qwirkle/QwirkleClassLibrary/Game.cs index 64c9a2b..ac82117 100644 --- a/Qwirkle/QwirkleClassLibrary/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Game.cs @@ -12,27 +12,35 @@ namespace QwirkleClassLibrary private TileBag bag; private List players; - public Game(List pl) { + public Game(List pl) + { players = pl; bag = new TileBag(); } - public void SetNextPlayer(Player player_old, Player player_new) + public int PositionPlayerPlay() { - for(int i = 0; i < players.Count; i++) + for (int i = 0; i < players.Count; i++) { - if (players[i] == player_old) - { - players[i].IsPlaying = false; - } - if (players[i] == player_new) + if (players[i].IsPlaying == true) { - players[i].IsPlaying = true; + return i; } - } - + return -1; + } + + public void SetNextPlayer(int old, int neew) + { + players[old].IsPlaying = false; + players[neew].IsPlaying = false; + Console.WriteLine(players[neew].GetName + "you have main now !"); + } } + + + +} } diff --git a/Qwirkle/QwirkleConsoleApp/Program.cs b/Qwirkle/QwirkleConsoleApp/Program.cs index b58a5f3..ee5dc17 100644 --- a/Qwirkle/QwirkleConsoleApp/Program.cs +++ b/Qwirkle/QwirkleConsoleApp/Program.cs @@ -54,4 +54,16 @@ static Game InitializerGame() return new Game(Players); } -Game game = InitializerGame(); \ No newline at end of file +static void NextPlayer(Game game) +{ + int posPlayerPlay = game.PositionPlayerPlay(); + + int posPlayerNextPlay = (game.PositionPlayerPlay() + 1); + + game.SetNextPlayer(posPlayerPlay, posPlayerNextPlay); + +} + +Game game = InitializerGame(); + +NextPlayer(game); \ No newline at end of file