Ajoute les commentaires et la documentation RDoc

This commit is contained in:
julien committed 2026-10-08 21:45:11 +02:00
1 parent cbc8b5c7c5
commit b0fd3c100c
12 files changed
+20 -11

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ https://docs.netig.net/ecarte/
## Lancer le jeu ## Lancer le jeu
```sh ```sh
ruby main.rb ./bin/ecarte
``` ```
## État du projet ## État du projet
Regular → Executable
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require_relative "lib/game" require_relative "../lib/game"
# Crée une partie. # Crée une partie.
game = Game.new("Alice", "Bob") game = Game.new("Alice", "Bob")
+1 -2
View File
@@ -120,8 +120,7 @@
<h2 id="label-Lancer+le+jeu">Lancer le jeu<span><a href="#label-Lancer+le+jeu">&para;</a> <a href="#top">&uarr;</a></span></h2> <h2 id="label-Lancer+le+jeu">Lancer le jeu<span><a href="#label-Lancer+le+jeu">&para;</a> <a href="#top">&uarr;</a></span></h2>
<pre class="ruby"><span class="ruby-identifier">ruby</span> <span class="ruby-identifier">main</span>.<span class="ruby-identifier">rb</span> <pre>./bin/ecarte</pre>
</pre>
<h2 id="label-C3-89tat+du+projet">État du projet<span><a href="#label-C3-89tat+du+projet">&para;</a> <a href="#top">&uarr;</a></span></h2> <h2 id="label-C3-89tat+du+projet">État du projet<span><a href="#label-C3-89tat+du+projet">&para;</a> <a href="#top">&uarr;</a></span></h2>
+8 -3
View File
@@ -148,6 +148,11 @@
<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;Choose a card: &quot;</span> <span class="ruby-identifier">print</span> <span class="ruby-string">&quot;Choose a card: &quot;</span>
<span class="ruby-identifier">choice</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-identifier">choice</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">to_i</span>
<span class="ruby-keyword">until</span> <span class="ruby-identifier">choice</span>.<span class="ruby-identifier">between?</span>(<span class="ruby-value">1</span>, <span class="ruby-identifier">player</span>.<span class="ruby-identifier">hand</span>.<span class="ruby-identifier">length</span>)
<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;Invalid choice. Choose a card: &quot;</span>
<span class="ruby-identifier">choice</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">to_i</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">player</span>.<span class="ruby-identifier">hand</span>[<span class="ruby-identifier">choice</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-identifier">player</span>.<span class="ruby-identifier">hand</span>[<span class="ruby-identifier">choice</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
<span class="ruby-keyword">end</span></pre> <span class="ruby-keyword">end</span></pre>
</div> </div>
@@ -175,7 +180,7 @@
<div class="method-description"> <div class="method-description">
<div class="method-source-code" id="debug_game-source"> <div class="method-source-code" id="debug_game-source">
<pre><span class="ruby-comment"># File lib/terminal_ui.rb, line 28</span> <pre><span class="ruby-comment"># File lib/terminal_ui.rb, line 33</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">debug_game</span>(<span class="ruby-identifier">game</span>) <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">debug_game</span>(<span class="ruby-identifier">game</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Dealer: #{game.dealer.name}&quot;</span> <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Dealer: #{game.dealer.name}&quot;</span>
<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Non-dealer: #{game.non_dealer.name}&quot;</span> <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Non-dealer: #{game.non_dealer.name}&quot;</span>
@@ -222,7 +227,7 @@
<div class="method-description"> <div class="method-description">
<div class="method-source-code" id="display_trick_winner-source"> <div class="method-source-code" id="display_trick_winner-source">
<pre><span class="ruby-comment"># File lib/terminal_ui.rb, line 22</span> <pre><span class="ruby-comment"># File lib/terminal_ui.rb, line 27</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">display_trick_winner</span>(<span class="ruby-identifier">player</span>) <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">display_trick_winner</span>(<span class="ruby-identifier">player</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{player.name} wins the trick.&quot;</span> <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{player.name} wins the trick.&quot;</span>
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">puts</span>
@@ -252,7 +257,7 @@
<div class="method-description"> <div class="method-description">
<div class="method-source-code" id="display_wrong_card-source"> <div class="method-source-code" id="display_wrong_card-source">
<pre><span class="ruby-comment"># File lib/terminal_ui.rb, line 17</span> <pre><span class="ruby-comment"># File lib/terminal_ui.rb, line 22</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">display_wrong_card</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">display_wrong_card</span>
<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;You cannot play this card.&quot;</span> <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;You cannot play this card.&quot;</span>
<span class="ruby-keyword">end</span></pre> <span class="ruby-keyword">end</span></pre>
+4 -4
View File
@@ -1,8 +1,8 @@
Thu, 08 Oct 2026 21:05:51 +0200 Thu, 08 Oct 2026 21:45:00 +0200
/home/julien/src/ecarte/README.md Thu, 08 Oct 2026 21:05:03 +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/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/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/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/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/lib/terminal_ui.rb Thu, 08 Oct 2026 21:21:51 +0200
/home/julien/src/ecarte/main.rb Thu, 08 Oct 2026 19:41:38 +0200
Binary file not shown.
+5
View File
@@ -10,6 +10,11 @@ class TerminalUI
print "Choose a card: " print "Choose a card: "
choice = gets.chomp.to_i 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] player.hand[choice - 1]
end end
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.