We have a square 10x10 meter garden outside our house. We want to plant grass and make a terrace. We have decided how to divide the garden, but we haven't decided the ratio between amount of grass vs terrace.
We need help visualizing it, and ASCII-art is clearly the best way to do so.
Challenge:
Take an integer in the inclusive range [0, 100] (or optionally decimal [0, 1]) representing how many percent of the garden should be terrace.
One square meter of terrace will be represented by either a dash -
or a bar |
. One square meter of grass will be represented by a hash mark #
.
- If the amount of terrace is less than or equal to 50%, then the garden should be covered with bars, starting in the bottom left corner, and fill vertically, then horizontally.
- If the amount of terrace is more than 50% then we want the decking to be the other way (dashes instead of bars), and starting in the bottom left corner, and fill horizontally, then vertically.
Examples:
N = 25%
||########
||########
||########
||########
||########
|||#######
|||#######
|||#######
|||#######
|||#######
N = 75%
##########
##########
-----#####
----------
----------
----------
----------
----------
----------
----------
N = 47%
||||######
||||######
||||######
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
N = 50%
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
|||||#####
N = 51%
##########
##########
##########
##########
-#########
----------
----------
----------
----------
----------
N = 0%
##########
##########
##########
##########
##########
##########
##########
##########
##########
##########
N = 100%
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
This is code-golf so the shortest code in bytes win. Standard rules regarding I/O. This is ASCII-art, so the output should look like the examples above. I.e. outputting ["|", "|" ...]
is not OK.
Explanations are encouraged as always :)