30
3
It's likely that anyone who used Twitter a couple of months ago would know about the 'Howdy! I'm the sheriff of X" meme. Where a simple image of a sheriff is drawn with emoji, and changes to fit a theme. So I thought it was time for the Sheriff of Code Golf. Here he is:
###
#####
###
###
###
#
#####
# # #
# # #
# # #
#
###
# #
# #
# #
# #
This one in particular has 'pixels' which are one character wide, and one character high. To generate him, the arguments will be 1 and 1.
What if he is to be wider than he is tall?
######
##########
######
######
######
##
##########
## ## ##
## ## ##
## ## ##
##
######
## ##
## ##
## ##
## ##
He's got a height of 1, but a width of 2.
Rules:
- The challenge is to write code to draw your own Sheriff of Code Golf, in the fewest characters possible.
- Use any programming language your heart desires.
- Your code should take two arguments, both of which are integers, for the height and width of the Sheriff.
- The output should be composed of single white spaces for the background, and any other character(s) you choose for the Sheriff. (I've used hashes for the test cases, but it doesn't matter what you use).
- It should be possible for the height to be a negative integer, inverting the image.
- The width can be a negative integer, but because the image is symmetrical, it will be identical to it's positive value.
- Trailing white-spaces are irrelevant.
- If either argument is 0, that dimension is 'flattened' to a single row or column. The length of this line is the other argument multiplied by the height, or width of the Sheriff, respectively.
- If both arguments are 0, both lines are 'flattened', leaving a single positive character.
- Not essential, but please include a link to an online interpreter such as tio.run
- The output should be a string, over multiple lines, or output to the console.
Test Cases
1 high, 1 wide
###
#####
###
###
###
#
#####
# # #
# # #
# # #
#
###
# #
# #
# #
# #
2 high, 1 wide
###
###
#####
#####
###
###
###
###
###
###
#
#
#####
#####
# # #
# # #
# # #
# # #
# # #
# # #
#
#
###
###
# #
# #
# #
# #
# #
# #
# #
# #
1 high, 2 wide
######
##########
######
######
######
##
##########
## ## ##
## ## ##
## ## ##
##
######
## ##
## ##
## ##
## ##
2 high, 2 wide
######
######
##########
##########
######
######
######
######
######
######
##
##
##########
##########
## ## ##
## ## ##
## ## ##
## ## ##
## ## ##
## ## ##
##
##
######
######
## ##
## ##
## ##
## ##
## ##
## ##
## ##
## ##
-1 high, 1 wide
# #
# #
# #
# #
###
#
# # #
# # #
# # #
#####
#
###
###
###
#####
###
1 high, -1 wide
###
#####
###
###
###
#
#####
# # #
# # #
# # #
#
###
# #
# #
# #
# #
0 high, 0 wide
#
1 high, 0 wide
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
0 high, 2 wide
##################
Have fun, y'all!
1
This challenge has reminded me of the Inverted World novel.
– Charlie – 2018-07-26T09:46:07.850Related: Picture of an old friend in ASCII art (variable scales; no inversion or flattening)
– Luis Mendo – 2018-07-26T09:58:41.563Observation: 1 high, 2 wide is the most human looking of the test cases, though I'm obligated to cheer for the Australian in the middle of it – Jo King – 2018-07-26T11:40:40.763
@JoKing If I was naming them, I'd definitle have (-1, 1) as 'Australian' and (-1, 2) as 'Realistic Australian'. Although... Perhaps that could be misunderstood. – AJFaraday – 2018-07-26T11:44:59.957
Closely related – Digital Trauma – 2018-07-26T15:23:48.927
Why do the 1-wide versions have an extra column of spaces at the left? – Οurous – 2018-07-27T00:24:20.263