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

Nicole and Yasmin #6

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8f4f07f
Baseline
yasminor Aug 29, 2016
d4a34f7
first spec passed
nurlywhirly Aug 30, 2016
5cdfd2e
three tests in initialize method pass
nurlywhirly Aug 30, 2016
47a440b
Five passing tests
yasminor Aug 30, 2016
87ba82a
WiP - Before lunch
nurlywhirly Aug 30, 2016
a216a28
Added self.score method
yasminor Aug 30, 2016
810adf3
got rid of collecting all word bc we weren't supposed to
nurlywhirly Aug 31, 2016
048ec4e
Added three tests for #highest_score_from_array class method
yasminor Aug 31, 2016
09977de
We think we understand you can only test inputs and outputs of methods
nurlywhirly Aug 31, 2016
c4302e6
WiP - lecture interrupting our building of a scored words hash
nurlywhirly Aug 31, 2016
56319bd
Added .gitignore
nurlywhirly Aug 31, 2016
84d33f1
WIP: building our scored hash in #highest_score_from_array
yasminor Aug 31, 2016
960941c
highest_score_from_array success
nurlywhirly Aug 31, 2016
9f3427c
nine tests running green on Scoring.rb
nurlywhirly Aug 31, 2016
ed2667d
Started Player class
yasminor Aug 31, 2016
58db8b8
Now testing to make sure #highest_score_from_array is returning the c…
yasminor Sep 1, 2016
4deaabd
WiP lunchtime commit. More player tests finished.
nurlywhirly Sep 1, 2016
af607ff
Finished Wave II
yasminor Sep 1, 2016
4bc6730
Began Tilebag class
yasminor Sep 1, 2016
4c361ec
Finished wave 3 yay
nurlywhirly Sep 1, 2016
d268ddd
Finished wave 3 requirement to tie tilebag to player
nurlywhirly Sep 2, 2016
5bbdd58
Fixed problem of drawing negative tiles
nurlywhirly Sep 2, 2016
3b046f7
This is the best that you get
yasminor Sep 2, 2016
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 wave 3 yay
nurlywhirly committed Sep 1, 2016
commit 4c361ec7481b2fa3444d779b927bac986da68513
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
/test/tmp/
/test/version_tmp/
/tmp/
/spec/.DS_Store
/specs/.DS_Store
.DS_Store

## Specific to RubyMotion:
24 changes: 24 additions & 0 deletions specs/tilebag_spec.rb
Original file line number Diff line number Diff line change
@@ -16,4 +16,28 @@
end
end

describe "#draw_tiles" do
it "should return an array" do
Scrabble::Tilebag.new.draw_tiles(1).must_be_kind_of Array
end

it "should return an array that has a length equal to number of tiles drawn" do
Scrabble::Tilebag.new.draw_tiles(1).length.must_equal(1)
end
end

describe "#tiles_remaining" do
it "should return a number" do
Scrabble::Tilebag.new.tiles_remaining.must_be_kind_of Fixnum
end

it "should return a number that is equal to the sum of the values in all_tiles hash" do
m = Scrabble::Tilebag.new
original_sum = m.all_tiles.values.reduce(:+)
m.draw_tiles(3)
m.draw_tiles(5)
m.tiles_remaining.must_equal(original_sum - 8)
end
end

end
15 changes: 15 additions & 0 deletions tilebag.rb
Original file line number Diff line number Diff line change
@@ -35,6 +35,21 @@ def initialize
}
end

def draw_tiles(num)
return_tiles = []

num.times do
tile = @all_tiles.keys.shuffle.pop
return_tiles << tile
@all_tiles[tile] -= 1
end

return return_tiles
end

def tiles_remaining
return @all_tiles.values.reduce(:+)
end

end
end