From a96a4097ba53030e687647f4a9c4d9db7a68058c Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Tue, 14 Mar 2023 14:23:15 +0100 Subject: [PATCH] [gosuhunt] rubocop'd --- ruby/bin/gosuhunt | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ruby/bin/gosuhunt b/ruby/bin/gosuhunt index 189e7aa..decf7a0 100755 --- a/ruby/bin/gosuhunt +++ b/ruby/bin/gosuhunt @@ -9,7 +9,7 @@ class GosuHunt < Gosu::Window def initialize( number_of_mines = 20 ) super 325, 180 - self.caption = "Gosu Hunt" + self.caption = 'Gosu Hunt' @number_of_mines = number_of_mines @field = MineHunt::Board.new( @number_of_mines ) @@ -74,15 +74,15 @@ class GosuHunt < Gosu::Window def update; end def draw - if @state[:dead] - self.caption = "You died! :(, score #{@field.score} " - elsif @state[:victory] - self.caption = "You won!! :), score #{@field.score} " - else - self.caption = "#{@field.number_of_mines} mines, #{@field.count_nearby_mines} nearby, score #{@field.score}" - end + self.caption = if @state[:dead] + "You died! :(, score #{@field.score} " + elsif @state[:victory] + "You won!! :), score #{@field.score} " + else + "#{@field.number_of_mines} mines, #{@field.count_nearby_mines} nearby, score #{@field.score}" + end - @font.draw_text( self.caption, 0, 0, 0 ) + @font.draw_text( caption, 0, 0, 0 ) @field.height.times do |y| @field.width.times do |x| @@ -96,8 +96,7 @@ class GosuHunt < Gosu::Window @images[:mine] else @images[:cell] - end ) - .draw( x * 2 * 10, (y * 20) + 20, 0 ) + end ).draw( x * 10, (y * 20) + 20, 0 ) end end end