From 342de5ce08a67b4056f50d307f1a286e64ae3928 Mon Sep 17 00:00:00 2001 From: "jeremy.mouyon" Date: Sun, 7 Apr 2024 16:02:43 +0200 Subject: [PATCH 1/2] switch nextplayer to method --- Qwirkle/QwirkleClassLibrary/Game.cs | 14 ++++++++++++++ Qwirkle/QwirkleConsoleApp/Program.cs | 24 ++++-------------------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Qwirkle/QwirkleClassLibrary/Game.cs b/Qwirkle/QwirkleClassLibrary/Game.cs index ebd470d..2575d90 100644 --- a/Qwirkle/QwirkleClassLibrary/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Game.cs @@ -80,6 +80,20 @@ namespace QwirkleClassLibrary } } + public void NextPlayer() + { + int posPlayerPlay = PositionPlayerPlay(); + + int posPlayerNextPlay = PositionPlayerPlay() + 1; + + if (posPlayerNextPlay >= GetNbPlayers) + { + posPlayerNextPlay = 0; + } + + SetNextPlayer(posPlayerPlay, posPlayerNextPlay); + } + } diff --git a/Qwirkle/QwirkleConsoleApp/Program.cs b/Qwirkle/QwirkleConsoleApp/Program.cs index 139ad3f..0b39762 100644 --- a/Qwirkle/QwirkleConsoleApp/Program.cs +++ b/Qwirkle/QwirkleConsoleApp/Program.cs @@ -55,32 +55,16 @@ static Game InitializerGame() return new Game(Players); } -static void NextPlayer(Game game) -{ - int posPlayerPlay = game.PositionPlayerPlay(); - - int posPlayerNextPlay = game.PositionPlayerPlay() + 1; - - if (posPlayerNextPlay >= game.GetNbPlayers) - { - posPlayerNextPlay = 0; - } - - game.SetNextPlayer(posPlayerPlay, posPlayerNextPlay); -} - - - static void testJeremy() { Game game = InitializerGame(); Write("\n -------------------------------------------------------- \n"); - NextPlayer(game); - NextPlayer(game); - NextPlayer(game); - NextPlayer(game); + game.NextPlayer(); + game.NextPlayer(); + game.NextPlayer(); + game.NextPlayer(); game.TilsBagPlayer(); From 26ac5d4b54f03c6d000c4c61233332f66a363cdd Mon Sep 17 00:00:00 2001 From: "jeremy.mouyon" Date: Sun, 7 Apr 2024 16:17:32 +0200 Subject: [PATCH 2/2] fix showtileofplayer --- Qwirkle/QwirkleClassLibrary/Game.cs | 2 +- Qwirkle/QwirkleClassLibrary/Tile.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Qwirkle/QwirkleClassLibrary/Game.cs b/Qwirkle/QwirkleClassLibrary/Game.cs index 2575d90..c133e31 100644 --- a/Qwirkle/QwirkleClassLibrary/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Game.cs @@ -50,7 +50,7 @@ namespace QwirkleClassLibrary foreach(Tile tile in tiles) { - r = (r + tile.NameColorTile()); + r = (r + " " + tile.NameColorTile()); } Console.WriteLine(r); diff --git a/Qwirkle/QwirkleClassLibrary/Tile.cs b/Qwirkle/QwirkleClassLibrary/Tile.cs index 4aa4589..0e77538 100644 --- a/Qwirkle/QwirkleClassLibrary/Tile.cs +++ b/Qwirkle/QwirkleClassLibrary/Tile.cs @@ -20,7 +20,7 @@ namespace QwirkleClassLibrary public string NameColorTile() { - return (color.ToString() + " , " + shape.ToString()); + return color.ToString() + shape.ToString(); } public Shape GetShape {