Weather forecasting: Wrong too often to rely on, right too often to ignore.
Given a high and low temperature and one of four weather conditions per day, output an ASCII-art graphical five day weather forecast. The structure of the four graphical indicators are shown below.
\ /
-O- Sunny
/ \
\ /
-O(==) Partly Cloudy
(====)
(==) Cloudy
(====)
(==)
(====) Rainy
/////
The forecasting chart is as follows: each graphical indicator is centered in its own 9x5 box, with 5 boxes across the chart. Each box is separated by |
characters. Below the graphical indicator is a three-letter abbreviation for the day of the week (MON, TUE, WED, THU, FRI, SAT, SUN
) centered in its own 9x1 box. The temperatures are below the day of the week centered in their own 9x2 box. An example is shown below.
---------------------------------------------------
| | | | | |
| (==) | (==) | \ / | \ / | \ / |
| (====) | (====) | -O(==) | -O- | -O- |
| | ///// | (====) | / \ | / \ |
| | | | | |
---------------------------------------------------
| MON | TUE | WED | THU | FRI |
---------------------------------------------------
| H 75 | H 69 | H 77 | H 80 | H 85 |
| L 57 | L 53 | L 61 | L 63 | L 66 |
---------------------------------------------------
Note that "centered" can be taken loosely -- see in the example how the graphical alignment and the temperature horizontal alignment are somewhat flexible.
Additionally, since I'm from the US and therefore use Fahrenheit, you can safely assume that the temperatures are all double-digit, so 9 < t < 100
.
I/O and Rules
The I/O examples here are demonstrative of the above example chart.
Input can be taken in any reasonable format and by any convenient method. For example,
1) you could use numbers for the days of the week, the high and low temperatures, and the four conditions, and take input as five tuples, like[0, 75, 57, 2], [1, 69, 53, 3], ...
2) you could take input as five tuples using words, like['MON', 75, 57, 'CLOUDY'], ['TUE', 69, 53, 'RAINY'] ...
3) you could take input as just the first day, and a list of high temperatures, a list of low temperatures, and a list of conditions, like1, [75, 69, ...], [57, 53, ...], [2, 3, ...]
4) etc.Leading/trailing newlines or other whitespace are optional, provided that the characters line up appropriately.
- Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
- Output can be to the console, returned as a list of strings, returned as a single string, etc.
- Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.