This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def triangle(a, b, c) | |
kolmio = Array.new | |
kolmio = [a, b, c] | |
if kolmio.size.uniq == 1 then | |
return :equilateral | |
elsif kolmio.uniq.size == 2 then | |
return :isosceles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def triangle(a, b, c) | |
kolmio = [a, b, c] | |
if a >= 0 || b >= 0 || c >= 0 | |
raise TriangleError.new('No side can be zero or negative') | |
end | |
if ((a >= b + c) || (b >= a + c) || (c >= a + b)) | |
raise TriangleError.new('No side can be equal or greater than sum of the other sides') | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implement a DiceSet Class here: | |
class DiceSet | |
def initialize | |
@noppaluvut = Array.new(5) | |
end | |
def roll(montako) | |
# if montako.size == 0 || montako.size > 6 | |
# raise error? | |
# arvo noppaluvut, parametri kertoo montako noppaa? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implement a DiceSet Class here: | |
class DiceSet | |
def initialize | |
@noppaluvut = self.roll(5) | |
end | |
def roll(montako) | |
@noppaluvut = [] | |
montako.times do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Analyzer | |
def initialize(target_object) | |
@object = target_object | |
end | |
end |