Class: Codebreaker::Codemaker
- Inherits:
-
Object
- Object
- Codebreaker::Codemaker
- Defined in:
- lib/codebreaker/codemaker.rb
Constant Summary collapse
- RANGE_OF_NUMBERS =
(1..6).freeze
- AMOUNT_OF_NUMBERS =
4
Instance Attribute Summary collapse
-
#secret_code ⇒ Object
readonly
Returns the value of attribute secret_code.
Instance Method Summary collapse
Instance Attribute Details
#secret_code ⇒ Object (readonly)
Returns the value of attribute secret_code.
8 9 10 |
# File 'lib/codebreaker/codemaker.rb', line 8 def secret_code @secret_code end |
Instance Method Details
#generate_secret_code(amout = AMOUNT_OF_NUMBERS, range = RANGE_OF_NUMBERS) ⇒ Object
10 11 12 13 14 |
# File 'lib/codebreaker/codemaker.rb', line 10 def generate_secret_code(amout = AMOUNT_OF_NUMBERS, range = RANGE_OF_NUMBERS) array_of_numbers = [] amout.times { array_of_numbers << rand(range) } @secret_code = array_of_numbers.join.to_i end |