# Iron particles around a magnet

There are some iron particles on a board. We pass a current carrying wire through that board and the particles form circles. Show these circles if input given is the position of the wire.

Consider the board to be a grid of size 7x7 (fixed)

No extra white spaces are allowed.

Input can be 0-indexed or 1-indexed. (0-indexed in examples)

### Examples

input:3,3 # 'X' is wire here but can be shown by anything other than '\/|-'
output:
/-----\
|/---\|
||/-\||
|||X|||
||\-/||
|\---/|
\-----/

input:1,2
output:
|/-\|||
||X||||
|\-/|||
\---/||
-----/|
------/
-------

input:0,0
output:
X||||||
-/|||||
--/||||
---/|||
----/||
-----/|
------/

input:0,3
output:
|||X|||
||\-/||
|\---/|
\-----/
-------
-------
-------

input:3,0
output:
---\|||
--\||||
-\|||||
X||||||
-/|||||
--/||||
---/|||


This is code-golf so shortest code wins.

• Can the function output a 7x7 matrix with the characters or we need to print it on the console ? – digEmAll Dec 12 '18 at 15:00

# J, 40 bytes

7 7{.6 6&-|.0":<^:6@8[9!:7@'/_\___\_/|-'


Try it online!

• Neat use of box drawing once again! Can you provide an axplanation of the entire solution? Thanks! – Galen Ivanov Dec 12 '18 at 14:09

# R, 136119 116 bytes

function(i,j,m=diag(7),R=row(m)-i,a=j-col(m)){m[]='-'
m[R==a]='\\'
m[R==-a]='/'
m[R<a&R>-a|R>a&-R>a]='|'
m[i,j]=0
m}


Try it online!

• -3 bytes saved thanks to @Giuseppe

Function that takes (row,col) coordinates of the wire (1-indexed) and returns a 7x7 matrix with the characters.

# Canvas, 272322 21 bytes

-７×［\＋］↶ω⟳ｎ↔┼⁷⁸╵７７＠↕↔


Try it here!

# JavaScript (ES7),  105  103 bytes

Takes input as (y)(x), 0-indexed.

Y=>X=>(g=x=>y<7?/\\-|X
[h=(X-x)**2,v=(Y-y)**2,x<7?h<v?2:h>v?3:h?x<X^y<Y:4:5]+g(x<7?x+1:!++y):'')(y=0)


Try it online!

# Perl 6, 90 bytes

{<| v - \ X />[1+([-]($_>>.abs).sign||3+[*]($_).sign)for ^7-$^a X ^7-$^b].rotor(7)>>.join}


Try it online!

Anonymous code block that takes two numbers and returns a list of lines.

# Python 2, 105 bytes

lambda x,y:[''.join(['/-|'[cmp(abs(i-x),abs(j-y))],'\X'[i==x]][i-x==y-j]for j in R)for i in R]
R=range(7)


Try it online!

# Charcoal, 21 bytes

ＧL⁷-↙⁶X‖Ｂ↘¬‖Ｊ±Ｎ±ＮＴ⁷¦⁷


Try it online! Takes 0-indexed column and row as input. Explanation:

ＧL⁷-


Draw a triangle of -s.

↙⁶


Draw a line along the hypotenuse. (This is the wrong way around but we'll fix that later.)

X


Draw the X that shows the position of the wire. (Any other ASCII character could be used here of course.) This completes one eighth of the drawing.

‖Ｂ↘¬


Reflect three times (¬ = left + down) while transforming characters to almost complete the diagram.

‖


Reflect without transforming to switch the /s with the \s so they now point around the X instead of towards it.

Ｊ±Ｎ±Ｎ


Ｔ⁷¦⁷