i'm new to programming, would anyone mind giving this basic game a review? it's pretty minimal, but i'd like to know if there are obvious places i can improve now
Don't use getters and setters in Ruby. Java is pretty much the only language where they're ever needed.
Also, instead of string concatenation and explicit calls to .to_s all the time I'd use string interpolation more (i.e. puts "Player took " + (@playerStartingHealth.to_i - @player.getCurrentHealth.to_i).to_s + " damage." simplifies to puts "Player took #{@playerStartingHealth - player.getCurrentHealth} damage." (why are you using .to_i on integers?)), but that's mostly just a matter of taste.
Name:
Anonymous2012-11-04 0:52
What should I use in place of getters setters? That seems like the easiest way to do that as far as i'm aware.
>>9
What do Rubyists do when they get_really_long_method_names? The usual Cee programmer cop out is to abbreviate in some random fashion (get_rlmnames).
>>10
Maybe this is just taste - things like player_starting_health strike me as being somewhat long, and I absolutely wouldn't tolerate them being even one word longer.
>>12
Well that's kind of a bad example - if you can identify that the function is doing two different things, you should just break it up into two functions that do one thing each.
Name:
Anonymous2012-11-04 16:16
>>13
Okay, how about frobnicate_the_doolally_unless_i_find_my_anus_is_foobar
Description: The function checks its anus (something the caller can't do, since it's a private thing), and if it isn't foobar, then it frobnicates the doolally.