Skip to content

ocodificador/sortudo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This README would normally document whatever steps are necessary to get the application up and running.

Things you may want to cover:

  • Ruby version

  • System dependencies

  • Configuration

  • Database creation

  • Database initialization

  • How to run the test suite

  • Services (job queues, cache servers, search engines, etc.)

  • Deployment instructions

Please feel free to use a different markup language if you do not plan to run rake doc:app.

# Playing “Being Lucky”

“Being Lucky” is is played among 2 or more players, using 5 six-sided dice.

## Playing “Being Lucky”

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.

## Interface

Your job is to implement BeingLucky

BeingLucky.new(dice).score

And the relative tests, RSpec is preferred, but Minitest is accepted. Provide a zip including a git project. Commits order, description and a comprehensible useful README are all part of the work.

Good luck and thanks for accepting the challenge!

About

A very simple implementation of "Being Lucky" game using Angular and Ruby on Rails

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors