diff --git a/doc/Game.html b/doc/Game.html index 323510d..faba14d 100644 --- a/doc/Game.html +++ b/doc/Game.html @@ -93,7 +93,6 @@
# File lib/game.rb, line 123 +# File lib/game.rb, line 131 def game_winner if @player1.score > @player2.score @player1 @@ -433,7 +444,7 @@-# File lib/game.rb, line 105 +# File lib/game.rb, line 111 def other_player(player) player == @player1 ? @player2 : @player1 end@@ -462,11 +473,13 @@-# File lib/game.rb, line 110 +# File lib/game.rb, line 116 def play lead_player = @non_dealer follow_player = @dealer + @ui.display_trump(@trump_suit) + 5.times do play_trick(lead_player, follow_player) @@ -499,7 +512,7 @@- ---# File lib/game.rb, line 80 +# File lib/game.rb, line 86 def play_trick(lead_player, follow_player) lead_card = @ui.choose_card(lead_player) follow_card = @ui.choose_card(follow_player) @@ -528,35 +541,6 @@--- -- - stock - () - ---- ---Source
--- ---# File lib/game.rb, line 64 -def stock - @deck.cards -end-Retourne les cartes restantes dans le talon.
-@@ -579,12 +563,18 @@@@ -180,7 +181,7 @@diff --git a/doc/TerminalUI.html b/doc/TerminalUI.html index 77970c0..b32bf5d 100644 --- a/doc/TerminalUI.html +++ b/doc/TerminalUI.html @@ -82,6 +82,7 @@# File lib/game.rb, line 69 def valid_follow_card?(follow_player, lead_card, follow_card) - if follow_card.suit == lead_card.suit - true - elsif follow_player.hand.any? { |card| card.suit == lead_card.suit } - false + if follow_player.hand.any? { |card| card.suit == lead_card.suit } + if follow_player.hand.any? { |card| card.suit == lead_card.suit && card.strength > lead_card.strength } + follow_card.suit == lead_card.suit && follow_card.strength > lead_card.strength + else + follow_card.suit == lead_card.suit + end else - true + if follow_player.hand.any? { |card| card.suit == @trump_suit } + follow_card.suit == @trump_suit + else + true + end end endchoose_card debug_game display_trick_winner +display_trump display_wrong_card -# File lib/terminal_ui.rb, line 33 +# File lib/terminal_ui.rb, line 38 def debug_game(game) puts "Dealer: #{game.dealer.name}" puts "Non-dealer: #{game.non_dealer.name}" @@ -227,7 +228,7 @@+ +-+# File lib/terminal_ui.rb, line 27 +# File lib/terminal_ui.rb, line 32 def display_trick_winner(player) puts "#{player.name} wins the trick." puts @@ -237,6 +238,35 @@++ ++ +++ +++Source
+++ +++# File lib/terminal_ui.rb, line 22 +def display_trump(trump_suit) + puts "Trump suit: #{trump_suit}" +end+Affiche la couleur d’atout.
+@@ -257,7 +287,7 @@-# File lib/terminal_ui.rb, line 22 +# File lib/terminal_ui.rb, line 27 def display_wrong_card puts "You cannot play this card." enddiff --git a/doc/created.rid b/doc/created.rid index b624bc3..b98bfd3 100644 --- a/doc/created.rid +++ b/doc/created.rid @@ -1,8 +1,9 @@ -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 21:21:51 +0200 +Fri, 09 Oct 2026 20:26:54 +0200 +/home/julien/src/ecarte/README.md Fri, 09 Oct 2026 19:12:21 +0200 +/home/julien/src/ecarte/bin/ecarte Fri, 09 Oct 2026 19:56:23 +0200 +/home/julien/src/ecarte/lib/card.rb Fri, 09 Oct 2026 19:12:21 +0200 +/home/julien/src/ecarte/lib/deck.rb Fri, 09 Oct 2026 19:12:21 +0200 +/home/julien/src/ecarte/lib/game.rb Fri, 09 Oct 2026 20:08:02 +0200 +/home/julien/src/ecarte/lib/player.rb Fri, 09 Oct 2026 19:12:21 +0200 +/home/julien/src/ecarte/lib/terminal_ui.rb Fri, 09 Oct 2026 19:54:30 +0200 +/home/julien/src/ecarte/tmp.rb Fri, 09 Oct 2026 20:14:12 +0200 diff --git a/doc/js/navigation.js.gz b/doc/js/navigation.js.gz index 8d6116e..195987f 100644 Binary files a/doc/js/navigation.js.gz and b/doc/js/navigation.js.gz differ diff --git a/doc/js/search_index.js b/doc/js/search_index.js index a32fdb9..88462b6 100644 --- a/doc/js/search_index.js +++ b/doc/js/search_index.js @@ -1 +1 @@ -var search_data = {"index":{"searchIndex":["card","deck","game","player","terminalui","add_point()","change_dealer()","choose_card()","clear_hand()","deal()","debug_game()","determine_dealer()","display_trick_winner()","display_wrong_card()","draw()","game_winner()","new()","new()","new()","new()","other_player()","play()","play()","play_trick()","receive()","shuffle()","stock()","strength()","to_s()","valid_follow_card?()","readme"],"longSearchIndex":["card","deck","game","player","terminalui","player#add_point()","game#change_dealer()","terminalui#choose_card()","player#clear_hand()","game#deal()","terminalui#debug_game()","game#determine_dealer()","terminalui#display_trick_winner()","terminalui#display_wrong_card()","deck#draw()","game#game_winner()","card::new()","deck::new()","game::new()","player::new()","game#other_player()","game#play()","player#play()","game#play_trick()","player#receive()","deck#shuffle()","game#stock()","card#strength()","card#to_s()","game#valid_follow_card?()",""],"info":[["Card","","Card.html","","Représente une carte à jouer avec sa valeur et sa couleur.\n"],["Deck","","Deck.html","","
Représente un paquet de cartes et gère son contenu.\n"],["Game","","Game.html","","
Gère le déroulement et les règles d’une partie d’Écarté.\n"],["Player","","Player.html","","
Représente un joueur, sa main et son score.\n"],["TerminalUI","","TerminalUI.html","","
Gère l’affichage et les saisies dans le terminal.\n"],["add_point","Player","Player.html#method-i-add_point","()","
Ajoute un point au joueur.\n"],["change_dealer","Game","Game.html#method-i-change_dealer","()","
Échange les rôles de donneur et de non-donneur.\n"],["choose_card","TerminalUI","TerminalUI.html#method-i-choose_card","(player)","
Demande au joueur de choisir une carte et la retourne.\n"],["clear_hand","Player","Player.html#method-i-clear_hand","()","
Vide la main du joueur.\n"],["deal","Game","Game.html#method-i-deal","()","
Distribue les cartes et pose la retourne.\n"],["debug_game","TerminalUI","TerminalUI.html#method-i-debug_game","(game)","
Affiche les informations de débogage.\n"],["determine_dealer","Game","Game.html#method-i-determine_dealer","()","
Simule une coupe pour déterminer quel joueur sera le donneur.\n"],["display_trick_winner","TerminalUI","TerminalUI.html#method-i-display_trick_winner","(player)","
Affiche le joueur ayant remporté le pli.\n"],["display_wrong_card","TerminalUI","TerminalUI.html#method-i-display_wrong_card","()","
Affiche un avertissement si le coup joué ne respecte pas les règles.\n"],["draw","Deck","Deck.html#method-i-draw","()","
Retire et retourne la dernière carte du paquet.\n"],["game_winner","Game","Game.html#method-i-game_winner","()","
Retourne le joueur ayant le meilleur score.\n"],["new","Card","Card.html#method-c-new","(value, suit)",""],["new","Deck","Deck.html#method-c-new","()",""],["new","Game","Game.html#method-c-new","(player_name1, player_name2)",""],["new","Player","Player.html#method-c-new","(name)",""],["other_player","Game","Game.html#method-i-other_player","(player)","
Retourne l’autre joueur.\n"],["play","Game","Game.html#method-i-play","()","
Joue une partie.\n"],["play","Player","Player.html#method-i-play","(card)","
Retire une carte de la main du joueur.\n"],["play_trick","Game","Game.html#method-i-play_trick","(lead_player, follow_player)","
Joue un pli.\n"],["receive","Player","Player.html#method-i-receive","(card)","
Ajoute une carte à la main du joueur.\n"],["shuffle","Deck","Deck.html#method-i-shuffle","()","
Mélange les cartes du paquet.\n"],["stock","Game","Game.html#method-i-stock","()","
Retourne les cartes restantes dans le talon.\n"],["strength","Card","Card.html#method-i-strength","()","
Retourne la force de la carte sous forme d’integer.\n"],["to_s","Card","Card.html#method-i-to_s","()","
Retourne une représentation de la carte sous forme de string.\n"],["valid_follow_card?","Game","Game.html#method-i-valid_follow_card-3F","(follow_player, lead_card, follow_card)","
Vérifie si le coup du second joueur respecte les règles.\n"],["README","","README_md.html","","
Écarté\n
Implémentation en Ruby du jeu de l’Écarté.\n
Le projet est développé progressivement au fur et …\n"]]}} \ No newline at end of file +var search_data = {"index":{"searchIndex":["card","deck","game","player","terminalui","add_point()","change_dealer()","choose_card()","clear_hand()","deal()","debug_game()","determine_dealer()","display_trick_winner()","display_trump()","display_wrong_card()","draw()","game_winner()","new()","new()","new()","new()","other_player()","play()","play()","play_trick()","receive()","shuffle()","strength()","to_s()","valid_follow_card?()","readme"],"longSearchIndex":["card","deck","game","player","terminalui","player#add_point()","game#change_dealer()","terminalui#choose_card()","player#clear_hand()","game#deal()","terminalui#debug_game()","game#determine_dealer()","terminalui#display_trick_winner()","terminalui#display_trump()","terminalui#display_wrong_card()","deck#draw()","game#game_winner()","card::new()","deck::new()","game::new()","player::new()","game#other_player()","game#play()","player#play()","game#play_trick()","player#receive()","deck#shuffle()","card#strength()","card#to_s()","game#valid_follow_card?()",""],"info":[["Card","","Card.html","","
Représente une carte à jouer avec sa valeur et sa couleur.\n"],["Deck","","Deck.html","","
Représente un paquet de cartes et gère son contenu.\n"],["Game","","Game.html","","
Gère le déroulement et les règles d’une partie d’Écarté.\n"],["Player","","Player.html","","
Représente un joueur, sa main et son score.\n"],["TerminalUI","","TerminalUI.html","","
Gère l’affichage et les saisies dans le terminal.\n"],["add_point","Player","Player.html#method-i-add_point","()","
Ajoute un point au joueur.\n"],["change_dealer","Game","Game.html#method-i-change_dealer","()","
Échange les rôles de donneur et de non-donneur.\n"],["choose_card","TerminalUI","TerminalUI.html#method-i-choose_card","(player)","
Demande au joueur de choisir une carte et la retourne.\n"],["clear_hand","Player","Player.html#method-i-clear_hand","()","
Vide la main du joueur.\n"],["deal","Game","Game.html#method-i-deal","()","
Distribue les cartes et pose la retourne.\n"],["debug_game","TerminalUI","TerminalUI.html#method-i-debug_game","(game)","
Affiche les informations de débogage.\n"],["determine_dealer","Game","Game.html#method-i-determine_dealer","()","
Simule une coupe pour déterminer quel joueur sera le donneur.\n"],["display_trick_winner","TerminalUI","TerminalUI.html#method-i-display_trick_winner","(player)","
Affiche le joueur ayant remporté le pli.\n"],["display_trump","TerminalUI","TerminalUI.html#method-i-display_trump","(trump_suit)","
Affiche la couleur d’atout.\n"],["display_wrong_card","TerminalUI","TerminalUI.html#method-i-display_wrong_card","()","
Affiche un avertissement si le coup joué ne respecte pas les règles.\n"],["draw","Deck","Deck.html#method-i-draw","()","
Retire et retourne la dernière carte du paquet.\n"],["game_winner","Game","Game.html#method-i-game_winner","()","
Retourne le joueur ayant le meilleur score.\n"],["new","Card","Card.html#method-c-new","(value, suit)",""],["new","Deck","Deck.html#method-c-new","()",""],["new","Game","Game.html#method-c-new","(player_name1, player_name2)",""],["new","Player","Player.html#method-c-new","(name)",""],["other_player","Game","Game.html#method-i-other_player","(player)","
Retourne l’autre joueur.\n"],["play","Game","Game.html#method-i-play","()","
Joue une partie.\n"],["play","Player","Player.html#method-i-play","(card)","
Retire une carte de la main du joueur.\n"],["play_trick","Game","Game.html#method-i-play_trick","(lead_player, follow_player)","
Joue un pli.\n"],["receive","Player","Player.html#method-i-receive","(card)","
Ajoute une carte à la main du joueur.\n"],["shuffle","Deck","Deck.html#method-i-shuffle","()","
Mélange les cartes du paquet.\n"],["strength","Card","Card.html#method-i-strength","()","
Retourne la force de la carte sous forme d’integer.\n"],["to_s","Card","Card.html#method-i-to_s","()","
Retourne une représentation de la carte sous forme de string.\n"],["valid_follow_card?","Game","Game.html#method-i-valid_follow_card-3F","(follow_player, lead_card, follow_card)","
Vérifie si le coup du second joueur respecte les règles.\n"],["README","","README_md.html","","
Écarté\n
Implémentation en Ruby du jeu de l’Écarté.\n
Le projet est développé progressivement au fur et …\n"]]}} \ No newline at end of file diff --git a/doc/js/search_index.js.gz b/doc/js/search_index.js.gz index 2bc9541..4be0aa9 100644 Binary files a/doc/js/search_index.js.gz and b/doc/js/search_index.js.gz differ diff --git a/doc/js/searcher.js.gz b/doc/js/searcher.js.gz index 59cf238..32b395d 100644 Binary files a/doc/js/searcher.js.gz and b/doc/js/searcher.js.gz differ diff --git a/doc/table_of_contents.html b/doc/table_of_contents.html index 3508a15..021a095 100644 --- a/doc/table_of_contents.html +++ b/doc/table_of_contents.html @@ -171,6 +171,11 @@ — TerminalUI +
+ #display_trump + — + TerminalUI + #display_wrong_card — @@ -216,11 +221,6 @@ — Deck - - #stock - — - Game - #strength —