我正在研究Ruby Koans,以便尝试学习Ruby,到目前为止,这非常好.我已经得到了贪婪的koan,在写这篇文章的时候是183.我有一个有效的解决方案,但我觉得我只拼凑了一堆if/then逻辑而且我不是拥抱Ruby模式.
在下面的代码中,您是否有方法指出我更全面地接受Ruby模式?(我的代码包含在"MY CODE [BEGINS | ENDS] HERE"评论中.
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 1000 points
#
# * A set of three numbers (other than ones) is worth 100 times the
# …Run Code Online (Sandbox Code Playgroud)