Challenge
Given a number width
, number height
, hours
and minutes
print the time using the following format style:
------ - ------ ------ - - ------ ------ ------ ------ ------
| | | | | | | | | | | | | |
| | | ------ ------ ------ ------ ------ | ------ ------
| | | | | | | | | | | | |
| | | | | | | | | | | | |
------ - ------ ------ - ------ ------ - ------ ------
For numbers with a mid line, when the height is odd just place it in the middle (example for height = 3
):
------
| |
------
| |
------
However, when the height is even you can choose up or down:
------ ------
| | | |
| | ------
------ | |
| | | |
------ ------
Of course, you need to specify this and use it every time.
Input
- W: The width of each number
- H: The height of each number
- HRS: Time hours
- MINS: Time minutes
Output
You can either print the time, return a string (including the newlines) or return a list of strings (one string per line).
Rules
- Assume number width
> 2
- Assume number height
> 2
- The space between numbers is fixed to
2
- The space between hours and minutes is fixed to
4
- If hours or minutes are
< 10
(single digit), make sure to add a0
(see example) - Assume that input hours and minutes will always be valid time
- Digit
1
is a special case which always has the same width1
and only it's height changes. - Height is considered the inner height, excluding the upper and lower rows of
---
(see example)
Example
Here's an example for W=6
, H=4
, hrs=2
, mins=18
:
------ ------ - ------
| | | | | |
| | ------ | ------
| | | | | |
| | | | | |
------ ------ - ------
1
always has a width of1
and only it's height changes. I will edit. \$\endgroup\$