From b0fd3c100c8dc970fd7f5ceb87f7cfc6ff341ac9 Mon Sep 17 00:00:00 2001 From: julien Date: Thu, 8 Oct 2026 21:45:11 +0200 Subject: [PATCH] Ajoute les commentaires et la documentation RDoc --- README.md | 2 +- main.rb => bin/ecarte | 2 +- doc/README_md.html | 3 +-- doc/TerminalUI.html | 11 ++++++++--- doc/created.rid | 8 ++++---- doc/js/search_index.js.gz | Bin 1327 -> 1327 bytes lib/terminal_ui.rb | 5 +++++ test/card_test.rb | 0 test/deck_test.rb | 0 test/game_test.rb | 0 test/player_test.rb | 0 test/terminal_ui_test.rb | 0 12 files changed, 20 insertions(+), 11 deletions(-) rename main.rb => bin/ecarte (79%) mode change 100644 => 100755 create mode 100644 test/card_test.rb create mode 100644 test/deck_test.rb create mode 100644 test/game_test.rb create mode 100644 test/player_test.rb create mode 100644 test/terminal_ui_test.rb diff --git a/README.md b/README.md index 9d4409f..0f4cfc5 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ https://docs.netig.net/ecarte/ ## Lancer le jeu ```sh -ruby main.rb +./bin/ecarte ``` ## État du projet diff --git a/main.rb b/bin/ecarte old mode 100644 new mode 100755 similarity index 79% rename from main.rb rename to bin/ecarte index 2f1afcb..7af7ee5 --- a/main.rb +++ b/bin/ecarte @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require_relative "lib/game" +require_relative "../lib/game" # Crée une partie. game = Game.new("Alice", "Bob") diff --git a/doc/README_md.html b/doc/README_md.html index f5ad076..fa020e8 100644 --- a/doc/README_md.html +++ b/doc/README_md.html @@ -120,8 +120,7 @@

Lancer le jeu ↑

-
ruby main.rb
-
+
./bin/ecarte

État du projet ↑

diff --git a/doc/TerminalUI.html b/doc/TerminalUI.html index 74dd4b0..77970c0 100644 --- a/doc/TerminalUI.html +++ b/doc/TerminalUI.html @@ -148,6 +148,11 @@ print "Choose a card: " choice = gets.chomp.to_i + until choice.between?(1, player.hand.length) + print "Invalid choice. Choose a card: " + choice = gets.chomp.to_i + end + player.hand[choice - 1] end @@ -175,7 +180,7 @@
-
# File lib/terminal_ui.rb, line 28
+            
# File lib/terminal_ui.rb, line 33
 def debug_game(game)
   puts "Dealer: #{game.dealer.name}"
   puts "Non-dealer: #{game.non_dealer.name}"
@@ -222,7 +227,7 @@
 
         
-
# File lib/terminal_ui.rb, line 22
+            
# File lib/terminal_ui.rb, line 27
 def display_trick_winner(player)
   puts "#{player.name} wins the trick."
   puts
@@ -252,7 +257,7 @@
 
         
-
# File lib/terminal_ui.rb, line 17
+            
# File lib/terminal_ui.rb, line 22
 def display_wrong_card
   puts "You cannot play this card."
 end
diff --git a/doc/created.rid b/doc/created.rid index 40d0f6a..b624bc3 100644 --- a/doc/created.rid +++ b/doc/created.rid @@ -1,8 +1,8 @@ -Thu, 08 Oct 2026 21:05:51 +0200 -/home/julien/src/ecarte/README.md Thu, 08 Oct 2026 21:05:03 +0200 +Thu, 08 Oct 2026 21:45:00 +0200 +/home/julien/src/ecarte/README.md Thu, 08 Oct 2026 21:44:51 +0200 +/home/julien/src/ecarte/bin/ecarte Thu, 08 Oct 2026 21:44:11 +0200 /home/julien/src/ecarte/lib/card.rb Thu, 08 Oct 2026 19:34:18 +0200 /home/julien/src/ecarte/lib/deck.rb Thu, 08 Oct 2026 19:33:38 +0200 /home/julien/src/ecarte/lib/game.rb Thu, 08 Oct 2026 19:33:06 +0200 /home/julien/src/ecarte/lib/player.rb Thu, 08 Oct 2026 19:32:32 +0200 -/home/julien/src/ecarte/lib/terminal_ui.rb Thu, 08 Oct 2026 19:37:44 +0200 -/home/julien/src/ecarte/main.rb Thu, 08 Oct 2026 19:41:38 +0200 +/home/julien/src/ecarte/lib/terminal_ui.rb Thu, 08 Oct 2026 21:21:51 +0200 diff --git a/doc/js/search_index.js.gz b/doc/js/search_index.js.gz index eda80cbe12cbbc3bce42bdc92402ddd590d41711..2bc954122927aabab08c9a0a2ae0fff4bf98a119 100644 GIT binary patch delta 15 WcmZ3_wVsPjzMF$%&!>%SnydgPSp>!a delta 15 WcmZ3_wVsPjzMF%i|K&zDO;!LV9t4m8 diff --git a/lib/terminal_ui.rb b/lib/terminal_ui.rb index 13e1af3..e621a4f 100644 --- a/lib/terminal_ui.rb +++ b/lib/terminal_ui.rb @@ -10,6 +10,11 @@ class TerminalUI print "Choose a card: " choice = gets.chomp.to_i + until choice.between?(1, player.hand.length) + print "Invalid choice. Choose a card: " + choice = gets.chomp.to_i + end + player.hand[choice - 1] end diff --git a/test/card_test.rb b/test/card_test.rb new file mode 100644 index 0000000..e69de29 diff --git a/test/deck_test.rb b/test/deck_test.rb new file mode 100644 index 0000000..e69de29 diff --git a/test/game_test.rb b/test/game_test.rb new file mode 100644 index 0000000..e69de29 diff --git a/test/player_test.rb b/test/player_test.rb new file mode 100644 index 0000000..e69de29 diff --git a/test/terminal_ui_test.rb b/test/terminal_ui_test.rb new file mode 100644 index 0000000..e69de29