Golf Dennis a thermometer

74

6

Dennis puts in a huge amount of effort for this community, including as moderator, language designer, and provider of TIO.

Unfortunately, his four-year-old daughter has caught a cold, so let us all help him keep track of her recovery (may it be speedy) by providing him with a thermometer:

.-----------.
|           |
|           |
'-.       .-'
.-'   -   '-.
|107.6- 42.0|
|106.7- 41.5|
|105.8- 41.0|
|104.9- 40.5|
|104.0- 40.0|
|103.1- 39.5|
|102.2- 39.0|
|101.3- 38.5|
|100.4- 38.0|
| 99.5- 37.5|
| 98.6- 37.0|
| 97.7- 36.5|
| 96.8- 36.0|
| 95.9- 35.5|
| 95.0- 35.0|
'---. - .---'
    | - |
    |---|
    |   |
    '---'

Since Dennis does not have much time to read code, you must keep yours as short as possible.

Adám

Posted 2017-04-26T18:38:32.167

Reputation: 37 779

13The shape reminds me more of a pregnancy test ._. – Magic Octopus Urn – 2017-04-26T19:08:52.583

1

@carusocomputing Inspiration. But hey, maybe she doesn't have a cold, but is just pregnant? This could of course be good or bad…

– Adám – 2017-04-26T19:12:16.927

2@Adám is there anything you don't have a source for :P? – Magic Octopus Urn – 2017-04-26T19:13:36.687

3@carusocomputing That he puts in a huge amount of effort. Maybe all that he does is really easy for him. Did he ever mention it being hard? – Adám – 2017-04-26T19:18:01.687

2

I've found proof of Dennis busy with life chores, but google comes up empty for all this PPCG nonsense haha.

– Magic Octopus Urn – 2017-04-26T19:25:41.700

I dare you to add citations to every word in this post ;) – Beta Decay – 2017-04-26T19:31:12.193

8Aww, hope she gets well. Anyways, I'm giving a +100 bounty to who makes a functional thermometer! :P – Matthew Roh – 2017-04-26T22:55:14.220

1@SIGSEGV I'm in. – Adám – 2017-04-26T22:55:53.467

1@Adám O_o that includes sneaking in Dennis' house and secretly attaching a thermometer on his daughter :\ – Matthew Roh – 2017-04-26T22:57:30.063

4

@SIGSEGV Try it online! - Source

– Adám – 2017-04-26T23:11:01.623

...Why isn't there Dennis:The language yet though? – Matthew Roh – 2017-04-27T13:33:20.153

5@SIGSEGV it'd be a menace. – Magic Octopus Urn – 2017-04-27T18:05:47.610

@SIGSEGV So Jelly? – dkudriavtsev – 2017-04-27T19:04:30.730

@Nobody You should consider making "make a functional thermometer" a separate question. Depending on specs, it might be like 44 bytes in Mathematica... – Mark S. – 2017-08-12T16:42:29.033

Answers

16

Jelly, 90 89 84 83 82 bytes

-1 byte thanks to Erik the Outgolfer (replace 10 with )

15r1×€9,5+“£Ȧ“¡^’d⁵Dj€€”.j€⁾- Uz⁶ZUj@€⁾||
“¡ẹƭgụḌẊṘgYƊxyẓṡƝçƤ5ȥṭ’ṃ“.| '-”s7ŒBs5j¢Y

Try it online!

How?

15r1×€9,5+“£Ȧ“¡^’d⁵Dj€€”.j€⁾- Uz⁶ZUj@€⁾|| - Link 1, body: no arguments
15r1                                      - inclusive range(15,1)      = [15,14,...,2,1]
      9,5                                 - pair nine with five        = [9,5]
    ×€                                    - multiply for €ach          = [[135,75],[126,70],...,[18,10],[9,5]]
          “£Ȧ“¡^’                         - list of base 250 numbers   = [941,345]
         +                                - addition                   = [[1076,420],[1067,415],...,[959,355],[950,350]]
                 d⁵                       - div&mod 10                 = [[[107,6],[42,0]],[[106,7],[41,5]],...,[[95,9],[35,5]],[[95,0],[35,0]]]
                   D                      - convert to decimal lists   = [[[[1,0,7],6],[[4,2],0]],[[[1,0,6],7],[[4,1],5]],...,[[[9,5],9],[[3,5],5]],[[[9,5],0],[[3,5],0]]]
                       ”.                 - literal '.'
                    j€€                   - join €ach for €ach         = [[[1,0,7,'.',6],[4,2,'.',0]],[[1,0,6,'.',7],[4,1,'.',5]],...,[[9,5,'.',9],[3,5,'.',5]],[[9,5,'.',0],[3,5,'.',0]]]
                           ⁾- <space      - literal ['-',' ']
                         j€               - join €ach                  = [[1,0,7,'.',6,'-',' ',4,2,'.',0],[1,0,6,'.',7,'-',' ',4,1,'.',5],...,[9,5,'.',9,'-',' ',3,5,'.',5],[9,5,'.',0,'-',' ',3,5,'.',0]]
                              U           - upend (reverse each)       = [[0,'.',2,4,' ','-',6,'.',7,0,1],[5,'.',1,4,' ','-',7,'.',6,0,1],...,[0,'.',5,3,' ','-',9,'.',5,9],[0,'.',5,3,' ','-',0,'.',5,9]]
                               z⁶         - transpose space filler     = [[0,5,...,5,0],['.','.',...,'.','.'],[2,1,...,5,5],[4,4,...,3,3],[' ',' ',...,' ',' '],['-','-',...,'-','-'],[6,7,...,9,0],['.','.',...'.','.'],[7,6,...,5,5],[0,0,...,9,9],[1,1,...,' ',' ']]
                                 Z        - transpose                  = [[0,'.',2,4,' ','-',6,'.',7,0,1],[5,'.',1,4,' ','-',7,'.',6,0,1],...,[5,'.',5,3,' ','-',9,'.',5,9,' '],[0,'.',5,3,' ','-',0,'.',5,9,' ']]
                                  U       - upend                      = [[1,0,7,'.',6,'-',' ',4,2,'.',0],[1,0,6,'.',7,'-',' ',4,1,'.',5],...,[' ',9,5,'.',9,'-',' ',3,5,'.',5],[' ',9,5,'.',0,'-',' ',3,5,'.',0]]
                                      ⁾|| - literal ['|','|']
                                   j@€    - join €ach (reversed @rgs)  = [['|',1,0,7,'.',6,'-',' ',4,2,'.',0,'|'],['|',1,0,6,'.',7,'-',' ',4,1,'.',5,'|'],...,['|',' ',9,5,'.',9,'-',' ',3,5,'.',5,'|'],['|',' ',9,5,'.',0,'-',' ',3,5,'.',0,'|']]
                                          -                  effectively ["|107.6- 42.0|","|106.7- 41.5|","|105.8- 41.0|","|104.9- 40.5|","|104.0- 40.0|","|103.1- 39.5|","|102.2- 39.0|","|101.3- 38.5|","|100.4- 38.0|","| 99.5- 37.5|","| 98.6- 37.0|","| 97.7- 36.5|","| 96.8- 36.0|","| 95.9- 35.5|","| 95.0- 35.0|"]

“¡ẹƭgụḌẊṘgYƊxyẓṡƝçƤ5ȥṭ’ṃ“.| '-”s7ŒBs5j¢Y - Main link: no arguments   (using "..." below to represent lists of characters)
“¡ẹƭgụḌẊṘgYƊxyẓṡƝçƤ5ȥṭ’                  - base 250 number     =  1694125525350532761476179586378844141697690917975
                        “.| '-”          - literal ['.','|',' ',"'",'-']
                       ṃ                 - base decompression  =  ".------|      |      '-.    .-'   -'---. -    | -    |--    |      '--"
                               s7        - split into 7s       =  [".------","|      ","|      ","'-.    ",".-'   -","'---. -","    | -","    |--","    |  ","    '--"]
                                 ŒB      - bounce (vectorises) =  [".-----------.","|           |","|           |","'-.       .-'",".-'   -   '-.","'---. - .---'","    | - |    ","    |---|    ","    |   |    ","    '---'    "]
                                   s5    - split into 5s       = [[".-----------.","|           |","|           |","'-.       .-'",".-'   -   '-."],["'---. - .---'","    | - |    ","    |---|    ","    |   |    ","    '---'    "]]
                                      ¢  - call last link (1) as a nilad
                                     j   - join                = (using "..." below to represent mixed-type lists from the result of ¢)
                                                               = [".-----------.","|           |","|           |","'-.       .-'",".-'   -   '-.","|107.6- 42.0|","|106.7- 41.5|","|105.8- 41.0|","|104.9- 40.5|","|104.0- 40.0|","|103.1- 39.5|","|102.2- 39.0|","|101.3- 38.5|","|100.4- 38.0|","| 99.5- 37.5|","| 98.6- 37.0|","| 97.7- 36.5|","| 96.8- 36.0|","| 95.9- 35.5|","| 95.0- 35.0|","'---. - .---'","    | - |    ","    |---|    ","    |   |    ","    '---'    "]
                                       Y - join with newlines  = :
                                                                 .-----------.
                                                                 |           |
                                                                 |           |
                                                                 '-.       .-'
                                                                 .-'   -   '-.
                                                                 |107.6- 42.0|
                                                                 |106.7- 41.5|
                                                                 |105.8- 41.0|
                                                                 |104.9- 40.5|
                                                                 |104.0- 40.0|
                                                                 |103.1- 39.5|
                                                                 |102.2- 39.0|
                                                                 |101.3- 38.5|
                                                                 |100.4- 38.0|
                                                                 | 99.5- 37.5|
                                                                 | 98.6- 37.0|
                                                                 | 97.7- 36.5|
                                                                 | 96.8- 36.0|
                                                                 | 95.9- 35.5|
                                                                 | 95.0- 35.0|
                                                                 '---. - .---'
                                                                     | - |
                                                                     |---|
                                                                     |   |
                                                                     '---'

Jonathan Allan

Posted 2017-04-26T18:38:32.167

Reputation: 67 804

12

Batch, 325 bytes

@echo off
for %%l in ("|           |" "|           |" "'-.       .-'" ".-'   -   '-.")do echo %%~l
set/ac=42,d=5
for /l %%f in (1076,-9,950)do call:c %%f
for %%l in ("'---. - .---'" "    | - |" "    |---|" "    |   |" "    '---'")do echo %%~l
exit/b
:c
set f= %1
set/ac-=!d,d=5-d
echo ^|%f:~-4,-1%.%f:~-1%- %c%.%d%^|

Neil

Posted 2017-04-26T18:38:32.167

Reputation: 95 035

11

SOGL, 98 97 bytes

▼⅜¦┌Υ   υl←│Γφγ⅔3wο╚°⁸ofč√&@⁶‘O’⁴∫ |O:9L/*’a6L/+;-l4=?@o}oƧ- o12/*’ ;-o |o"ģ⌠℮Ζ║Kgš‰¶¶ksθ○╤Ƨ%←└⅟ΟS‘

note: the 3 spaces close to the beggining of the program are a tab

Explanation:

...‘O                                                  output the beginning part
     ’⁴∫                                               repeat 15 times, pushing (0-indexed iteration)
         |O                                            output in a new line "|"
           :                                           duplicate the iteration
            9L/                                        push 0.9 (9/10)
               *                                       multiply [0.9 and the iteration]
                ’a6L/+                                 push 107.6 (107+6/10)
                      ;-                               reverse subtract (107.6 - 0.9*iteration)
                        l4=?  }                        if length is 4
                            @o                           output a space
                               o                       output the number
                                Ƨ- o                   output "- "
                                    12/                push 0.5 (1/2)
                                       *               multiply that by iteration
                                        ’              push 42
                                          ;-           reverse subtract (42-0.5*iteration)
                                            o          output that
                                              |o       output "|"
                                                "...‘  push the ending part

To save one byte, I made it push the ending string every time in the loop just so it could get outputted once.

dzaima

Posted 2017-04-26T18:38:32.167

Reputation: 19 048

4Dennis wants you to add a way to try it online so he doesn't have to spend time away from his daughter figuring out where to find a SOGL compiler. – owlswipe – 2017-04-27T02:05:03.060

1SOGL never ceases to impress me with its compression – user41805 – 2017-04-27T08:40:50.243

1@owlswipe While SOGL is in heavy development (for example, soon I'm gonna release a version that breaks all programs with functions or compression (I hope it's gonna be the last time)) trying stuff online will not be a priority – dzaima – 2017-04-27T12:57:27.580

2@dzaima I didn't realize you personally made SOGL! That is SO cool, very much forgiven for not having a compiler :)) – owlswipe – 2017-04-27T17:52:27.267

9

V, 113 bytes

i|1076- 420|14ñÙ9l5ñÎeé.$hé.
ç|9/á 
o'³-. - .³-'
| - |
|³-|
|³ |
'³-'4>3kHO.±±-.
|±± |Ùo'-.· .-'
.-'³ -³ '-.

Try it online!

Hexdump:

00000000: 697c 3130 3736 2d20 3432 307c 1b31 34f1  i|1076- 420|.14.
00000010: d939 186c 3518 f1ce 65e9 2e24 68e9 2e0a  .9.l5...e..$h...
00000020: e77c 392f e120 0a6f 27b3 2d2e 202d 202e  .|9/. .o'.-. - .
00000030: b32d 270a 7c20 2d20 7c0a 7cb3 2d7c 0a7c  .-'.| - |.|.-|.|
00000040: b320 7c0a 27b3 2d27 1b34 3e33 6b48 4f2e  . |.'.-'.4>3kHO.
00000050: b1b1 2d2e 0a7c b1b1 207c 1bd9 6f27 2d2e  ..-..|.. |..o'-.
00000060: b720 2e2d 270a 2e2d 27b3 202d b320 272d  . .-'..-'. -. '-
00000070: 2e                                       .

More golfing on the way!

James

Posted 2017-04-26T18:38:32.167

Reputation: 54 537

1Dennis doesn't understand how the hell that code works, but appreciate that it works very well in very few bytes. – owlswipe – 2017-04-27T02:04:03.450

@owlswipe I doubt it. We're talking about Dennis here; he knows how everything works. ;p – Kevin Cruijssen – 2017-04-28T09:34:29.700

@KevinCruijssen Maybe :)). I have no clue how this works though! – owlswipe – 2017-04-28T12:51:49.657

@owlswipe Me neither, so I agree it could use an explanation. :) – Kevin Cruijssen – 2017-04-28T12:58:04.573

7

PHP, 187 Bytes

storing 4 spaces in a variable saves 7 Bytes

<?=".-----------.
|",$f="    ","$f   |
|$f$f   |
'-.$f   .-'
.-'   -   '-.
";for($n=85;--$n>69;)printf("|%5.1f-%5.1f|
",$n*.9+32,$n/2);echo"'---. - .---'
$f| - |
$f|---|
$f|   |
$f'---'";

Try it online!

PHP, 188 Bytes

<?$s=".000--.
|1223|1223'-.12.-'
.-'1-1'-.
4";for($n=85;--$n>69;)$t.=sprintf("|%5.1f-%5.1f|
",$n*.9+32,$n/2);$s.="'0. - .0'
2| - 32|032|132'0'";echo strtr($s,["---","   ","    ","|
",$t]);

Try it online!

PHP, 220 Bytes

<?=gzinflate(base64_decode("XZBJCkUhDAT3niI7VzbOw908/O/EwIMviCnLQBukbyFc+db9o5jgNVIM3KwSd9S+khdmkl6Rr9LEIhUMo4Ft9FzHIWV3HdnouYaSpB13FdXouYJG2u4yupE6OewgLXNytmYhPbc0S5vupmYhPTc0SxvuhmYhZf0t58H/gWcMNgHSfRXvvLLJiE2B734="));

Try it online!

PHP, 247 Bytes

<?=bzdecompress(base64_decode("QlpoNDFBWSZTWREU1+kAAEnYgEiQQIN/4AAEMAC6bDTRA1NBtqglJ7VIA0AJNSEAAXhknxmxdEkbQhoFWMYrEL1cASWoMYgwHEpJJJKZmZ638CwPCeQHBCLKs3qj1vvz37lF4trWtWviLC4wJoHJywEMA8GmAh2WwUSEom/JeNAioiokhJa9V5bL02pVVVXw+EiwPxdyRThQkBEU1+k="));

Try it online!

Jörg Hülsermann

Posted 2017-04-26T18:38:32.167

Reputation: 13 026

5

Python 2, 163 bytes

i=89
for x in("------.x|x|x.-'x-   '-."+"x"*16+"- .---'x- |x--|x  |x--'").split('x'):y='%%-77ss'[i>80::2]%x;print['|%5s- %s|'%(32+.9*i,i/2.),y[:0:-1]+y][x>''];i-=1

Try it online!

xnor

Posted 2017-04-26T18:38:32.167

Reputation: 115 687

I’m late to this party, but y='%*s'%(i/80*14-7,x) saves a byte. – Lynn – 2017-08-12T17:56:39.103

4

///, 261 bytes

/`/\/\///i/|
|`~/---`_/   `+/- `f/.5`z/.0`(/i10`)/i 9`!/|
    |/
.--~~~.
|  ___i  ___|
'-. __.-'
.-'_-_'-.
|107.6+42z(6.7+41f(5.8+41z(4.9+40f(4.0+40z(3.1+39f(2.2+39z(1.3+38f(0.4+38z)9f+37f)8.6+37z)7.7+36f)6.8+36z)5.9+35f)5.0+35z|
'~. - .~'
    | - !~!_|
    '~'

Try it online!

Works by using common occurrences like --- as replacements. Nothing fancy.

Comrade SparklePony

Posted 2017-04-26T18:38:32.167

Reputation: 5 784

4

APL (Dyalog), 144 143 bytesSBCS

m←⊢,1↓⌽
1⌽'.||',⍣2⊢11/⍪3↑d←'-'
m 7↑a←∪∊z←⊂'''---. -'
m(6↑⌽a),d
⊃{'|',⍵,'-',⍺,'|'}/(5 1⍕⍪)¨35 95+↓.5 .9∘.×⌽⍳15
↑m¨z,¯7↑¨'| -' '|--' '|  ' '''--'

Try it online!

Adám

Posted 2017-04-26T18:38:32.167

Reputation: 37 779

3

Mathematica 247 Bytes

Hmmm... same as PHP

Uncompress@"1:eJxtkLsNAyEQRM+d4OgiRssf2rBTR27ADdCG+/WAODYxEkL7eKDR3N+fx/N7Ow5YXXiJ893o6n/BabFG2HMAHhws97n+cFKQrYke0hfIKAQO6QIJdYJtRDQCUSNCJthGgLMmNDU8/ATbcAgEVQ1BnGAZpvE1QbkM0+pISrCNMpKGrEYeSQm2kUbSkNRIIymBrILYJfsY3c6CZnUEfQ+80eEq1swG+eYH1XhZzA=="

Kelly Lowder

Posted 2017-04-26T18:38:32.167

Reputation: 3 225

3

JavaScript (ES6), 198 bytes

Number formatting is a bit costly in JS and I seem to be stuck at this byte count. You win this time, PHP! ;-)

let f =

_=>`.222--.
|56|
|56|
'-.7.-'
.-'3-3'-.
000000000111111'2. - .2'
4| - |
4|2|
4|3|
4'2'`.replace(/\d/g,n=>['|'+(s=F(32+.9*i)+`- ${F(i--/2)}|
`),'| '+s,'---'][n]||' '.repeat(n),i=94,F=v=>v.toFixed(1))

console.log(f())

Arnauld

Posted 2017-04-26T18:38:32.167

Reputation: 111 334

1I hope that you are not angry about that I could save 8 Bytes more. Thank You for the reminder to try a second approach with strtr – Jörg Hülsermann – 2017-04-27T14:18:03.080

1@JörgHülsermann No worries! :) Well done! – Arnauld – 2017-04-27T14:23:51.220

3

Japt, 106 bytes

[".{6î-}
|
'-.
.-'   -"y y 9"'
-
-
-
.|||'
  - -
--- -"y]·mê0R d9FÆ"|{S+(#k6-9*X)t4n)i.J}- {½*Xn84)x1}|"÷

Test it online!

Many thanks to @obarakon who got the code working in the first place, and did quite a bit of the golfing.

Explanation

First we have the data:

[                                     // Create an array of:
  ".{6î-}\n|\n'-.\n.-'   -"           //   This string ({6î-} inserts 6 hyphens),
  y y                                 //   transposed twice to pad it with spaces;
  9                                   //   the number 9;
  "'\n-\n-\n-\n.|||'\n  - -\n--- -"   //   and this string,
  y                                   //   transposed once.
]·                                    // Join the array with newlines.

This gives us

.------
|      
'-.    
.-'   -
9
'---. -
    | -
    |--
    |  
    '--

That is, the left half of the thermometer, with the main rectangle replaced with a 9. Note that every line is padded with spaces except the one containing the 9.

m  R   // Map each line with the function
 ê     //   ê, or "bounce"; mirrors the string about its last character ("abc" -> "abcba").
       // (The 0 is just filler because `m` expects the `R` to be the third parameter)

The net effect is that it mirrors the left half of the thermometer to the right:

.-----------.
|           |
'-.       .-'
.-'   -   '-.
9
'---. - .---'
    | - |    
    |---|    
    |   |    
    '---'    

Now that we have the ASCII-art part, all we have to do is put in the main rectangle:

d9FÆ  "|{S+(#k 6-9*X)t4n)i.J}- {½ *Xn84)x1}|"Ã ·
d9FoX{"|{S+(1076-9*X)t4n)i.J}- {.5*Xn84)x1}|"} qR

  FoX{  ...  }        // Create the range [0...15), and map each item X to
"|{ ... }- { ... }"   //   this string, with the two blanks filled in with...

S+(1076-9*X)t4n)i.J
   1076-9*X           //   Calculate 1076 - 9*X. This gives us °F * 10.
S+(        )t4n)      //   Prepend a space and take only the last 4 chars.
                      //   This pads the entries under 100°F to the correct length.
                i.J   //   Insert a decimal point before the last char.
                      //   This turns e.g. "1076" to "107.6".

.5*Xn84)x1
   Xn84               //   Take 84 - X.
.5*    )              //   Multiply it by 0.5. This gives us °C.
        x1            //   Convert to a string with exactly 1 decimal point.

                qR    // Join the resulting array with newlines.
d9                    // In the thermometer art, replace "9" with the resulting string.

And that concludes our ASCII-art generating session. Tune in next week to see more kinda-short ASCII-art programs written in Japt!

ETHproductions

Posted 2017-04-26T18:38:32.167

Reputation: 47 880

2

Charcoal, 62 bytes

←⁶↓.↓²'-.¶.-'¶↓¹⁵'³↓.↓³'²M²↖¹↑×¹⁹-‖OM⁵¦¹⁶←E¹⁵⮌⁺⁺⁺⁹⁵×·⁹ι- ⁺³⁵⊘ι

Try it online! Link is to verbose version of code. Explanation:

←⁶↓.↓²'-.¶.-'¶↓¹⁵'³↓.↓³'²M²↖¹↑×¹⁹-

Print the left half of the thermometer.

‖O

Reflect it to complete the body.

M⁵¦¹⁶←E¹⁵⮌⁺⁺⁺⁹⁵×·⁹ι- ⁺³⁵⊘ι

Compute the scales and print them reversed and up-side down, which right-justifies them. At time of writing, Charcoal's concatenation operator converts floats to strings using Python's built-in str which appends .0 for floats that represent integers, otherwise I would have to resort to formatting, as its Cast operator specifically avoids that behaviour.

Neil

Posted 2017-04-26T18:38:32.167

Reputation: 95 035

1

vim, 222 keystrokes

:.!seq 42 -0.5 35
:%!awk '{printf("|\%5.1f- \%.1f|\n",1.8*$1+32,$1)}'
Go'===. - .==='<ESC>yy
:s/=/-/g
p
:.!tr "'.=" ' | '
:s/ *$/
yyP
:s/-/ /
ddpPlR---<ESC>yyGp
:s/|/'/g
ggO..<ESC>11i-<ESC>yyP
:.!tr .- '| '
yypo'-.<ESC>7a <ESC>a.-'<ENTER>.-'   -   '-.<ESC>

Ray

Posted 2017-04-26T18:38:32.167

Reputation: 1 488

1

C, 234 bytes

main(i){float f=42;puts(".-----------.");for(;i--;)printf("|%*s|\n",11,"");puts("'-.       .-'\n.-'   -   '-.");for(;f>34.5;f-=.5)printf("|%5.1f- %.1f|\n",32+f*1.8,f);puts("'---. - .---'\n    | - |\n    |---|\n    |   |\n    '---'");}

Try it online

Output:

.-----------.
|           |
|           |
'-.       .-'
.-'   -   '-.
|107.6- 42.0|
|106.7- 41.5|
|105.8- 41.0|
|104.9- 40.5|
|104.0- 40.0|
|103.1- 39.5|
|102.2- 39.0|
|101.3- 38.5|
|100.4- 38.0|
| 99.5- 37.5|
| 98.6- 37.0|
| 97.7- 36.5|
| 96.8- 36.0|
| 95.9- 35.5|
| 95.0- 35.0|
'---. - .---'
    | - |
    |---|
    |   |
    '---'

Johan du Toit

Posted 2017-04-26T18:38:32.167

Reputation: 1 524

0

C, 460 265 bytes

#define P(x) puts(x);
#define Z "|           |"
T(){float i=7,j=12.6;P(".-----------.")P(Z)P(Z)P("'-.       .-'")P(".-'   -   '-.")while(i>=0)printf("|%5.1f- %.1f|\n",95+j,35+i),i-=.5,j-=.9;P("'---. - .---'")P("    | - |")P("    |---|")P("    |   |")P("    '---'")}

Output Live

.-----------.
|           |
|           |
'-.       .-'
.-'   -   '-.
|107.6- 42.0|
|106.7- 41.5|
|105.8- 41.0|
|104.9- 40.5|
|104.0- 40.0|
|103.1- 39.5|
|102.2- 39.0|
|101.3- 38.5|
|100.4- 38.0|
| 99.5- 37.5|
| 98.6- 37.0|
| 97.7- 36.5|
| 96.8- 36.0|
| 95.9- 35.5|
| 95.0- 35.0|
'---. - .---'
    | - |
    |---|
    |   |
    '---'

Khaled.K

Posted 2017-04-26T18:38:32.167

Reputation: 1 435

1This doesn't look very golfed. Can't you e.g. combine the two identical lines? Also, you have a leading space on all lines – Adám – 2017-04-27T13:37:57.980

@Adám golfed now. – Khaled.K – 2017-04-27T13:46:11.160

1Maybe you can define the four spaces and reuse them? For-loop with math for all the numbers? – Adám – 2017-04-27T13:51:43.483

@Adám thx, golfed further now. – Khaled.K – 2017-04-27T15:20:47.510

You're missing the lowest temperatures: 95.0- 35.0 – Adám – 2017-04-27T16:26:40.330

@Adám shows the lowest temps now. – Khaled.K – 2017-04-27T18:51:23.567

0

C, 222 bytes

f(){puts(".-----------.\n|           |\n|           |\n'-.       .-'\n.-'   -   '-.");for(float n=108.5,m=42.5;m>35;printf("|%5.1f- %.1f|\n",n-=.9,m-=.5));puts("'---. - .---'\n    | - |\n    |---|\n    |   |\n    '---'");}

Despite attempting to shorten the string, hardcoding it in a plain format is the best option. I doubt that any (significant) improvement is possible in C.

2501

Posted 2017-04-26T18:38:32.167

Reputation: 748

0

Go, 238 bytes

Wow, that string is really resistant to golfing...

package main
import."fmt"
func main(){p:=Printf
s,i:=`|           |
`,42.
p(`.-----------.
`+s+s+`'-.       .-'
.-'   -   '-.
`)
for;i>=35;i-=.5{
p(`|%5.1f- %.1f|
`,i*9/5+32,i)}
p(`'---. - .---'
    | - |
    |---|
    |   |
    '---'`)}

Try live here: https://play.golang.org/p/tPKYxII7NC

Kristoffer Sall-Storgaard

Posted 2017-04-26T18:38:32.167

Reputation: 489