Beta
Measure your card house
Description:
Measure your card house
This is an extension to the kata Level up your card house.
If you experience issues finding the number of floors try solving this kata first.
Your task this time, should you accept: is to build a card house with the given number of cards, and then measure the triangle outline of the entire card house.
To be able to do that we are making the following assumptions:
- The outline is the sum of the three sides of the outer triangle.
- The unit of measure for all params is millimeter
- The card dimensions are fixed as size B8
- card length: 88 mm
- card width: 62 mm
- To measure the height, sum the height of all floors and add the sum of the height of the horizontal bottoms between the floors.
- The deck thickness is given as an input parameter and should be used to calculate the card thickness.
This card thickness is needed to calculate the height of the horizontal bottoms between the floors!!
Assume that a deck always contains 52 cards.- To measure the width, consider the space between two cards that form a house, assume that the space between two adjacent triangles is always zero. This space called the card distance is measured from the outside, meaning it already includes the card thickness. You only need to consider the card thickness when calculating the height!
input params
- nr_of_cards (integer)
the maximum number of cards available to build the card house- card_distance (integer)
the distance (in mm) two cards are placed from each other to form the triangles (including the card_thickness)
0 < card_distance <= 75- deck_thickness (integer)
the thickness (in mm) of a full deck of playing cards, containing 52 cards
10 <= deck_thickness <= 20
expected result
- float >= 0
the outline of the entire card house in mm
rounded to a precision of 4 decimals
an error range is accepted up to 0.0001
examples
CardHouse.calculate_outline(1, 42, 13) # returns 0.0
CardHouse.calculate_outline(2, 33, 11) # returns 209.0
CardHouse.calculate_outline(52, 29, 13) # returns 1026.9727
hints
- consider Pythagoras as your friend in the calculations...
happy coding...
Mathematics
Fundamentals
Similar Kata:
Stats:
Created | Jan 10, 2020 |
Published | Jan 11, 2020 |
Warriors Trained | 74 |
Total Skips | 3 |
Total Code Submissions | 15 |
Total Times Completed | 4 |
Elixir Completions | 4 |
Total Stars | 2 |
% of votes with a positive feedback rating | 50% of 2 |
Total "Very Satisfied" Votes | 1 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 1 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 6 kyu |