Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
wesley974 committed Mar 13, 2017
1 parent 8dc28a4 commit a1903da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 0 additions & 4 deletions lib/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ def tries
def time
Time.now - @statistics[:start_time]
end

def to_s
tries.to_s + ' attempts in ' + time.to_s.red + " seconds!\n"
end
end
9 changes: 7 additions & 2 deletions lib/user_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ def play

def new_score
puts ' New Score !!'.red.bold \
if @board.add(@name, @player.tries, @player.time)
if @board.add(@name, @player.tries, @rt)
view_score
PressAnyKey.new
play
end

def check_winner
puts @player
info
if @player.tries == 1
puts ' We have found our magician ?!'
else
Expand All @@ -97,4 +97,9 @@ def ctrlc
bybye
end
end

def info
@rt = @player.time
puts "#{@player.tries} attempts in " + @rt.to_s.red + "seconds!\n"
end
end

0 comments on commit a1903da

Please sign in to comment.