Conversation
weird bug that the game takes inupt without actually taking it when guess has all the correct nums, but in the wrong order
Pin logic now implemented. The previous issue was that using the until loop I was treating as a while or something weird.
the tests are mainly regarding dif cases that compare_to_guess will output correctly
lib/game_status.rb
Outdated
| def again(user, code) | ||
| GameStatus.game_over?(user.guesses_left) | ||
| code.compare_to_guess(user.take_input) | ||
| again(user, code) |
There was a problem hiding this comment.
again isn't very descriptive. Maybe try_again?
lib/secret_code.rb
Outdated
There was a problem hiding this comment.
Er I mean, don't require pry after you're done, get rid of it.
Trick: require 'pry'; binding.pry is a one liner to initiate pry w/o requiring it at the top of the file so you don't forget to remove it
| red_pin = feedback.count('red') | ||
| white_pin = feedback.count('white') | ||
|
|
||
| return [red_pin, white_pin] |
There was a problem hiding this comment.
Returns aren't really needed here
spec/secret_code_spec.rb
Outdated
There was a problem hiding this comment.
If it's public, it should be tested
There was a problem hiding this comment.
it's not, it's a private method that is called in a public method that is tested below it. So it's technically already being tested?, but i'm not sure whether I should test is as well for more specific-ness?
There was a problem hiding this comment.
If it's private, it can't be tested. You can test the public method thoroughly
There was a problem hiding this comment.
Or extract it out into another file and then test it
There was a problem hiding this comment.
Right I can't even access it because it's private . . . facepalm
That makes sense, I think that I'll just end up removing it as it's really only testing if this method can count correctly x_x
spec/secret_code_spec.rb
Outdated
There was a problem hiding this comment.
Are these supposed to still be pending? ...Also, I tend to see to eq(THING) more than that way
forgot to revise some of the tests
this method was private and didn't provide much behaviour to test
| code = SecretCode.new | ||
| code.code = [1, 1, 2, 2] | ||
| it '2 red and 2 white expected' do | ||
| secret_code.code = [1, 1, 2, 2] |
There was a problem hiding this comment.
spacing nitpicks => new lines between test cases,
|
|
||
| # am I just testing random cases at this point? is this ok? | ||
| describe '#compare_to_guess' do | ||
| # am I just testing random cases at this point? is this ok? |
There was a problem hiding this comment.
Maybe. Maybe hone down the test cases the test the basic core functionality. Are some of them basically testing the same arithmetic and function multiple times?
spec/secret_code_spec.rb
Outdated
There was a problem hiding this comment.
These are good test cases...
Implemented feedback into the program; the user will now get the correct feedback after their guess.