koans:Ruby Koans

  • q1_808451
    了解作者
  • 37.4KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-23 09:14
    上传日期
新的Ruby Koans Ruby Koans 将带您走上启蒙之路,以学习 Ruby。 目标是学习 Ruby 语言、语法、结构以及一些常用函数和库。 我们还通过以测试为基础来教你文化。 测试不仅仅是我们口头上的事情,而是我们生活的事情。 测试对于您在 Ruby 中学习和做伟大的事情是必不可少的。 结构 公案按文件划分为多个区域,散列包含在about_hashes.rb ,模块在about_modules.rb中引入,等等。 它们在path_to_enlightenment.rb文件中按顺序显示。 每个公案都建立了您对 Ruby 的了解并建立在其自身之上。 它会在您需要纠正的第一个地方停止。 一些公案只需要用正确的答案代替错误的答案。 但是,有些要求您提供自己的答案。 如果您看到列出的方法__ (双下划线),则提示您提供自己的代码以使其正常工作。 安装Ruby 如果您没有 Ru
koans-master.zip
  • koans-master
  • about_regular_expressions.rb
    4.5KB
  • about_asserts.rb
    981B
  • .path_progress
    3B
  • about_constants.rb
    2KB
  • about_message_passing.rb
    4.7KB
  • about_blocks.rb
    2.3KB
  • about_strings.rb
    4.9KB
  • about_objects.rb
    1.2KB
  • about_scope.rb
    1.8KB
  • about_arrays.rb
    1.8KB
  • about_methods.rb
    3.5KB
  • about_open_classes.rb
    934B
  • about_triangle_project_2.rb
    675B
  • about_true_and_false.rb
    735B
  • about_scoring_project.rb
    1.9KB
  • about_hashes.rb
    2.8KB
  • example_file.txt
    15B
  • about_sandwich_code.rb
    2.5KB
  • README.rdoc
    7KB
  • about_iteration.rb
    3.2KB
  • about_modules.rb
    1.1KB
  • triangle.rb
    556B
  • about_triangle_project.rb
    798B
  • about_nil.rb
    1023B
  • about_control_statements.rb
    2.7KB
  • Rakefile
    159B
  • neo.rb
    13.8KB
  • about_classes.rb
    3.8KB
  • about_array_assignment.rb
    1.3KB
  • about_keyword_arguments.rb
    886B
  • about_dice_project.rb
    1.4KB
  • about_proxy_object_project.rb
    3.2KB
  • about_to_str.rb
    1.3KB
  • about_java_interop.rb
    4KB
  • about_symbols.rb
    2.6KB
  • GREED_RULES.txt
    2.3KB
  • about_extra_credit.rb
    317B
  • about_class_methods.rb
    3.6KB
  • about_exceptions.rb
    1.6KB
  • path_to_enlightenment.rb
    1.1KB
  • koans.watchr
    41B
  • about_inheritance.rb
    1.6KB
内容介绍
= Playing Greed Greed is a dice game played among 2 or more players, using 5 six-sided dice. == Playing Greed Each player takes a turn consisting of one or more rolls of the dice. On the first roll of the game, a player rolls all five dice which are scored according to the following: Three 1's => 1000 points Three 6's => 600 points Three 5's => 500 points Three 4's => 400 points Three 3's => 300 points Three 2's => 200 points One 1 => 100 points One 5 => 50 points A single die can only be counted once in each roll. For example, a "5" can only count as part of a triplet (contributing to the 500 points) or as a single 50 points, but not both in the same roll. Example Scoring Throw Score --------- ------------------ 5 1 3 4 1 50 + 2 * 100 = 250 1 1 1 3 1 1000 + 100 = 1100 2 4 4 5 4 400 + 50 = 450 The dice not contributing to the score are called the non-scoring dice. "3" and "4" are non-scoring dice in the first example. "3" is a non-scoring die in the second, and "2" is a non-score die in the final example. After a player rolls and the score is calculated, the scoring dice are removed and the player has the option of rolling again using only the non-scoring dice. If all of the thrown dice are scoring, then the player may roll all 5 dice in the next roll. The player may continue to roll as long as each roll scores points. If a roll has zero points, then the player loses not only their turn, but also accumulated score for that turn. If a player decides to stop rolling before rolling a zero-point roll, then the accumulated points for the turn is added to his total score. == Getting "In The Game" Before a player is allowed to accumulate points, they must get at least 300 points in a single turn. Once they have achieved 300 points in a single turn, the points earned in that turn and each following turn will be counted toward their total score. == End Game Once a player reaches 3000 (or more) points, the game enters the final round where each of the other players gets one more turn. The winner is the player with the highest score after the final round. == References Greed is described on Wikipedia at http://en.wikipedia.org/wiki/Greed_(dice_game), however the rules are a bit different from the rules given here.
评论