Python 2, 172 147 128 117 112 bytes
lambda w:ord('8%\x1806(*D\x0e0t0\x1d'[sum(map(ord,w.replace(*'gM')))%77%24%13])*(2+('/'in w))*(4-('g'in w))/160.
Explanation:
Encodes the window as a sum of the ordinals of each char (without trailing g
):
sum(map(ord,w[:(w+'g').find('g')]))
| -> 124 / -> 47
|| -> 248 // -> 94
| | -> 280 / / -> 126
|+| -> 291 /+/ -> 137
|++| -> 334 /++/ -> 180
|+++| -> 377 /+++/ -> 223
|r -> 238 /r -> 161
||r -> 362 //r -> 208
|f -> 226 /f -> 149
||f -> 350 //f -> 196
These are modded (%77%24%13
), which gives values from 0 to 12):
sum(map(ord,w[:(w+'g').find('g')]))%77%24%13
| -> 124 -> 10 / -> 47 -> 10
|| -> 248 -> 4 // -> 94 -> 4
| | -> 280 -> 1 / / -> 126 -> 1
|+| -> 291 -> 12 /+/ -> 137 -> 12
|++| -> 334 -> 2 /++/ -> 180 -> 2
|+++| -> 377 -> 8 /+++/ -> 223 -> 8
|r -> 238 -> 7 /r -> 161 -> 7
||r -> 362 -> 6 //r -> 208 -> 6
|f -> 226 -> 0 /f -> 149 -> 0
||f -> 350 -> 5 //f -> 196 -> 5
The Ug
values are multiplied by 20
and mapped to chars:
[0.7, 1.2, 1.45, 1.85, 2.0, 2.1, 2.7, 2.8, 3.4, 5.8]
[14, 24, 29, 37, 40, 42, 54, 56, 68, 116]
['\x0e', '\x18', '\x1d', '%', '(', '*', '6', '8', 'D', 't']
These chars are then ordered accordingly to the window-types, and padded with '0's
. This new strign is used to look up the value based on the index.
'8%\x1806(*D\x0e0t0\x1d'#[sum(map(ord,w[:(w+'g').find('g')]))%77%24%13])
Lastly the given character is converted back into a number, and multiplied be the diagonal window and isolating curtain factors
*(2+('/'in w))*(4-('g'in w))/160.
equivalent to:
*2/2 or 3/2 * 4/4 or 3/4 /20
Saved
- -5 bytes, thanks to ovs