Skip to content

Commit

Permalink
refactor for readability, loop variables need not be word-y
Browse files Browse the repository at this point in the history
  • Loading branch information
Eben Geer committed Mar 6, 2012
1 parent 924d101 commit fef08a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions codebreaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ def start(secret)

def guess(guess)
mark = ''
(0..3).each do |index|
if guess[index] == @secret[index]
(0..3).each do |i|
if guess[i] == @secret[i]
mark.insert(0, '+')
guess[index] = ' '
elsif guess.include?(@secret[index])
guess[i] = ' '
elsif guess.include?(@secret[i])
mark << '-'
end
end
Expand Down

0 comments on commit fef08a4

Please sign in to comment.