The best options for the glass of your house will:
1. Let through as little heat as possible in both directions (insulation-value
(2. Let through as much sunbeams as possible from the outside to the inside.)
(3. Let through as much light as possible from the outside to the inside.)
We only care about the first one for this challenge.
In addition, there are different types of glass changing the
Ug: regular single glass; regular double glass; HR double glass; HR+ double glass; HR++ double glass; HR+++ double glass.
HR = High Rendement glass; regular double glass with have air between both layers, but HR will have a noble gas between both layers.
Sources (not very useful for most though, because they are in Dutch, but added them anyway): Insulate and save money and What is HR++ glass?
Input: A string indicating glass and window foil (below the possible input-strings are explained)
Output: (Calculate and) output the heat-transition
Here a table with all glass options and the expected output
Glass (optional foil) Ug-value Description | 5.8 Single-layered regular glass || 2.7 Double-layered regular glass | | 1.85 HR glass |+| 1.45 HR+ glass |++| 1.2 HR++ glass |+++| 0.7 HR+++ glass |r 3.4 Single-layered regular glass with reflective foil ||r 2.1 Double-layered regular glass with reflective foil |f 2.8 Single-layered regular glass with regular window-foil ||f 2.0 Double-layered regular glass with regular window-foil |g 4.35 | with insulating curtain ||g 2.025 || with insulating curtain | |g 1.3875 | | with insulating curtain |+|g 1.0875 |+| with insulating curtain |++|g 0.9 |++| with insulating curtain |+++|g 0.525 |+++| with insulating curtain |rg 2.55 |r with insulating curtain ||rg 1.575 ||r with insulating curtain |fg 2.1 |f with insulating curtain ||fg 1.5 ||f with insulating curtain / 8.7 Diagonal | // 4.05 Diagonal || / / 2.775 Diagonal | | /+/ 2.175 Diagonal |+| /++/ 1.8 Diagonal |++| /+++/ 1.05 Diagonal |+++| /r 5.1 Diagonal |r //r 3.15 Diagonal ||r /f 4.2 Diagonal |f //f 3.0 Diagonal ||f /g 6.525 Diagonal | with insulating curtain //g 3.0375 Diagonal || with insulating curtain / /g 2.08125 Diagonal | | with insulating curtain /+/g 1.63125 Diagonal |+| with insulating curtain /++/g 1.35 Diagonal |++| with insulating curtain /+++/g 0.7875 Diagonal |+++| with insulating curtain /rg 3.825 Diagonal |r with insulating curtain //rg 2.3625 Diagonal ||r with insulating curtain /fg 3.15 Diagonal |f with insulating curtain //fg 2.25 Diagonal ||f with insulating curtain
Some things to note about the values: the first ten are all the different default values (taken from the two linked sources). Adding a
g (insulating curtain) lowers that value by 25%. Having a
/ (diagonal window) increases that value by 50%.
- You can ignore any floating point precision errors
- You can use the default decimal output-format of your languages, so if
3.0is output as
3instead; or if
0.9is output as
.9instead, it doesn't matter.
- You'll only have to worry about the input-options given above. Inputting anything else may result in undefined behavior (weird outputs, errors, etc.)
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
- Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
- Default Loopholes are forbidden.
- If possible, please add a link with a test for your code.
- Also, please add an explanation of your answer.