module Yahtzee::Dice

Yahtzee::Dice is just a dice dsl for yahtzee

Constants

DIE_FACES
MAX_DIE_COUNT

Public Class Methods

reroll(keepers) click to toggle source
# File lib/dice.rb, line 13
def self.reroll(keepers)
  new_roll = keepers + roll(MAX_DIE_COUNT-keepers.count)
  new_roll[0..(MAX_DIE_COUNT-1)]
end
roll(num) click to toggle source
# File lib/dice.rb, line 8
def self.roll(num)
  limit = num > MAX_DIE_COUNT ? MAX_DIE_COUNT : num
  1.upto(limit).map {|die| rand(1..DIE_FACES) }
end