From f9d94fcb27d1d3a1ed0f8850d279f0eba2077f73 Mon Sep 17 00:00:00 2001 From: Rikuoh Date: Thu, 21 Mar 2024 19:50:34 +0900 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bowling.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bowling.rb b/bowling.rb index 83b358a..3c921e0 100755 --- a/bowling.rb +++ b/bowling.rb @@ -26,6 +26,7 @@ frames[0..8].each_with_index do |frame, index| point += frames[index + 1].first if frame.sum == 10 && frame != strike end -frames[9..11].map { |frame| point += frame.sum } # 条件分岐を要しない加点処理 +point += frames[9..11].flatten.sum +# point += frames[9..11].sum{|frame| frame.sum} # ご提案頂いた例の回答 puts point