Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eric DeShetler #609

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5665dab
test
ejdesh Aug 24, 2024
4f7e53f
finished iteration 1
ejdesh Aug 24, 2024
f7f4774
adds Deck class
ejdesh Aug 24, 2024
898fcd0
adds an rspec test
ejdesh Aug 24, 2024
01f357c
adds count method
ejdesh Aug 24, 2024
ba5c6b6
deck spec PASS
ejdesh Aug 24, 2024
d4ac555
round partially working
ejdesh Aug 24, 2024
58befb2
adds round.number_correct_by_category
ejdesh Aug 25, 2024
853b354
adds percent_correct
ejdesh Aug 25, 2024
5d6ffe1
added current_card test
ejdesh Aug 25, 2024
87e3045
still working on current_card
ejdesh Aug 26, 2024
5b836a6
finishes iteration 2
ejdesh Aug 26, 2024
c984c2a
optimized methods
ejdesh Aug 26, 2024
5514112
removes current_card method
ejdesh Aug 26, 2024
b9ff0ef
test commit
ejdesh Aug 26, 2024
b79e530
simplified current_card
ejdesh Aug 26, 2024
7e5dc1d
removed unneccessary variable
ejdesh Aug 26, 2024
d5074e5
started runner
ejdesh Aug 27, 2024
9cc64c4
first question working
ejdesh Aug 27, 2024
88402a3
pushed correct runner this time
ejdesh Aug 27, 2024
2902704
adds round summary
ejdesh Aug 27, 2024
22ec08c
fixed: total_correct_by_category
ejdesh Aug 27, 2024
983148a
Final final commit
ejdesh Aug 27, 2024
de59a17
fixed some formatting issues
ejdesh Aug 27, 2024
1bd1f41
added get_round_from_file
ejdesh Aug 27, 2024
8f90795
ready for submission
ejdesh Aug 27, 2024
7268b82
added comment to file method
ejdesh Aug 27, 2024
f5cc49c
Merge pull request #1 from ejdesh/read_file
dcardona23 Aug 27, 2024
2c12d5f
added Game class
ejdesh Aug 28, 2024
ee3f87b
Adds project Synopsis
ejdesh Aug 28, 2024
c69d943
Merge pull request #2 from ejdesh/optimize
ejdesh Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
finished iteration 1
  • Loading branch information
ejdesh committed Aug 24, 2024
commit 4f7e53f76e64edb8933ae67816cb3a3259467e2d
2 changes: 1 addition & 1 deletion lib/card.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Card
attr_reader
attr_reader :question, :answer, :category

def initialize(question, answer, category)
@question = question
30 changes: 30 additions & 0 deletions lib/turn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class Turn
attr_reader :guess, :card

def initialize(guess, card)
@guess = guess
@card = card
@result = false
end

def a_guess
@guess
end

def a_card
@card
end

def correct?
@result = (guess == card.answer)
@result
end

def feedback
if @result
'Correct!'
else
'Incorrect.'
end
end
end
39 changes: 39 additions & 0 deletions spec/turn_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require './lib/card'
require './lib/turn'

RSpec.describe Turn do
it 'exists' do
card = Card.new('hi', 'bye', :whaatok)
turn = Turn.new('this is my guess', card)

expect(turn).not_to be_nil
end

it 'has a guess' do
card = Card.new('hi', 'bye', :whaatok)
turn = Turn.new('this is my guess', card)

expect(turn.a_guess).not_to be_nil
end

it 'has a card' do
card = Card.new('hi', 'bye', :whaatok)
turn = Turn.new('this is my guess', card)

expect(turn.card).not_to be_nil
end

it 'guesses correctly' do
card = Card.new('one plus one', 'two', :whaatok)
turn = Turn.new('two', card)

expect(turn.correct?).to eq true
end

it 'guesses incorrectly' do
card = Card.new('one plus one', 'two', :whaatok)
turn = Turn.new('three', card)

expect(turn.correct?).to eq false
end
end