Comments (5)
You may want to make the attributes read-only.
Reason: To prevent accidental modification of the attributes.
Example code:
attr_reader :player1, :player2, :deck, :crib
def initialize
@deck = Deck.new
@player1 = Player.new
@player2 = Player.new
@crib = []
end
from crib.
in start_round method have players draw from deck.
Reason: improve readability, and get rid of temporary variable.
Example code:
def start_round
6.times do
player1.draw_from(deck)
player2.draw_from(deck)
end
end
from crib.
Great idea. I can't wait to do all of this Friday night. Maybe have a look again on Sunday night?
from crib.
Sure! I'll watch the repo so I know when you've pushed your changes.
from crib.
Have score method return a string.
Reason: you may not want to write the score to stdout.
Example code:
def score
["Player1 Score: #{player1.score}", "Player2 Score: #{player2.score}"].join("\n")
end
Another option would be to have score take a destination as a parameter.
Reason: you can tell the method where to write the output, and let it handle formatting...
def write_score(io=STDOUT)
io.puts "Player1 Score: #{player1.score}"
io.puts "Player2 Score: #{player2.score}"
end
from crib.
Related Issues (12)
- Create a .gitignore file
- game_spec.rb: Code review. HOT 3
- player.rb: Code Review. HOT 1
- card.rb: Code Review HOT 6
- counter.rb: Code Review HOT 11
- card.rb: refactor display_value to to_s. HOT 3
- deck.rb: Code Review HOT 7
- card_spec.rb code review
- counter_spec.rb: Code Review. HOT 2
- Create a Rakefile
- deck_spec.rb: Code Review HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crib.