X Marks the spot
Your goal is to add a cross-hair around the capital X:
Example Input / Output
Input:
mdhyyyyyyyhhhddmmm
mdyyssoo oooosyyyhhhdmm
hsso oossoooooyyhhdhhdmmm
yoooooo oo ssysssyhhdyyyhmmmm
myso oso o oyo hhhdhhyhyhhm mm m
mhsyhhys oss yyyhhhsosyhhmmmmdmmm
mhyhhhy y ssyhoho o shhdmmmmdmmmm
hhyyyh s oo syysyyhhdysso oyhdhhhmmmmm
dhysyys sdysoXoyyyyhhso syshm mmm
hhyhyo o osss y shhyyhd mmmmmm
yyhyyyss o oyyyydmmdmmmmmmmmm mm
ysyhyhhho s osy sdm m mddmmddhydmmm
h oshhhyyyddhoo ooyysshdmdohdmmdmddsshmmm
y oyhhhdhhsyhsssshdddsss hdddyyyhddm
dyyshyyhssyyhyyyyddhhmmdmmmdy syssoosyhdm
hsyyhhhhsoo sooyyhhdoohdhhyhyysoo osdm
doyhhhyyyyhhhysyyy oossyyssso osydm
soyhyyhhhhhhyhyyyooos ohdddm
msoyyyyyyyhyyyyo ooo syyd
ho oyyysooo osso osyd
dhyyysssyyyyyysoosdm
mmdddddmmm
Output:
mdhyyyyyyyhhhddmmm
mdyyssoo oooosyyyhhhdmm
hsso oossoooooyyhhdhhdmmm
yoooooo oo ssysssyhhdyyyhmmmm
myso oso o oyo hhhdhhyhyhhm mm m
mhsyhhys oss | yyyhhhsosyhhmmmmdmmm
mhyhhhy y |ssyhoho o shhdmmmmdmmmm
hhyyyh s oo s|ysyyhhdysso oyhdhhhmmmmm
dhysyys -----X-----hhso syshm mmm
hhyhyo o | osss y shhyyhd mmmmmm
yyhyyyss |o oyyyydmmdmmmmmmmmm mm
ysyhyhhho s |sy sdm m mddmmddhydmmm
h oshhhyyyddhoo ooyysshdmdohdmmdmddsshmmm
y oyhhhdhhsyhsssshdddsss hdddyyyhddm
dyyshyyhssyyhyyyyddhhmmdmmmdy syssoosyhdm
hsyyhhhhsoo sooyyhhdoohdhhyhyysoo osdm
doyhhhyyyyhhhysyyy oossyyssso osydm
soyhyyhhhhhhyhyyyooos ohdddm
msoyyyyyyyhyyyyo ooo syyd
ho oyyysooo osso osyd
dhyyysssyyyyyysoosdm
mmdddddmmm
Input:
000000000000
000000000000
0000X0000000
0000000X0000
000000000000
000000000000
000000000000
000000000000
000000000000
000000000000
000000000000
000000000000
Output:
|
0000|00|0000
0000|00|0000
-----X--+--00
00--+--X-----
0000|00|0000
0000|00|0000
0000000|0000
000000000000
000000000000
000000000000
000000000000
000000000000
Input:
00000000000000000
00000000000000000
00000000000000000
00000X000X0000000
00000000000000000
00000000000000000
00000000000000000
00000000000000000
00000000000000000
00000000000000000
00000000000000000
00000000000000000
Output:
00000|000|0000000
00000|000|0000000
00000|000|0000000
----+#+++#+----00
00000|000|0000000
00000|000|0000000
00000|000|0000000
00000000000000000
00000000000000000
00000000000000000
00000000000000000
00000000000000000
Crosshair
Your cross-hair should be a 3-tall and 5-wide:
|
|
|
-----X-----
|
|
|
Input
Input will be at least 12x12 characters in size and will consist of only ASCII characters. It can be taken in through STDIN or function argument. The input will not always contain an X. Input will be in any shape and have an arbitrary amount of whitespace. The input will not contain any of: +
, -
, #
, and |
Output
Output can be through STDOUT or a function's return value. Output should be the input image with the cross-hair drawn. If there is not enough space to draw the crosshair, you must add lines / spaces to draw it. Overlapping spots should be replaced with a +
. If the |
or -
of the crosshairs overlaps an X
, instead of a +
, an #
should appear.
Trailing whitespace is not allowed except for a single newline at the very end.
This is code-golf so shortest code in bytes wins!
+
for overlapping-
and|
apply only when those characters are part of crosshairs, or does it affect literal-
and|
found in the input as well? \$\endgroup\$#
in the input is encountered by a crosshair? Will it be overwritten? \$\endgroup\$