Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

code review

Name: Anonymous 2012-11-04 0:07

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

http://pastie.org/5179576

Name: Anonymous 2012-11-04 0:41

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.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List