Long time lurker first time poster here.
Write a program which takes 3 inputs: X, Y and Z.
- X = across (columns)
- Y = down (rows)
- Z = Location Marker
The program should then print a visual grid X across and Y down. This grid will can be made of any character except "+". Each 'location' is given an index number, counting up from 1 at coordinate 1, 1 across and then down until the end.
X and Y will always be at least 3, and Z will never be bigger than X * Y
.
Z will represent the location which is printed as a "+", on the location as well as 1 character left, right, up and down. For example:
+
+++
+
Finally, if the + characters would intercept the edges (top most, left most, right most and/or down most edge), then the + should bounce back along the same axis and overflow the other side.
Examples: Input = 5, 5, 13
-----
--+--
-+++-
--+--
-----
Input = 10, 10, 10
-------+++
---------+
---------+
----------
----------
----------
----------
----------
----------
----------
Input = 10, 10, 21
----------
+---------
+++-------
+---------
----------
----------
----------
----------
----------
----------
Edit : non square example 16,3,32
---------------+
-------------+++
---------------+
I think I've covered everything. There should be no limit to the input, but if your program requires, cap it off at 64 * 64.
Bonus point (can I do that?): Input Z should not be > X * Y, but if it is larger than Y * Z, then output the center + to the middle of the grid.
EDIT: Input Z cannot be greater than X * Y
Edit 2:. Made some changes to X and Y to hopefully be clearer
This is code golf, shortest code wins.