# bc distance

Difficulty: Beginner   Keywords: Go term

Two points P1(b1,c1),P2(b2,c2).
d1=abs(b1-b2)
d2=abs(c1-c2)

.if min(d1,d2) <= 10 then d=max(d1,d2)*10+min(d1,d2) . else d=max(d1,d2)*100+min(d1,d2) .end-if

. Example.

. x(4,3),y(7,2)
d1=abs(4-7)=3 d2=abs(3-2)=1
d=31

. p(12,15),q(3,16) d1=abs(12-3)=9 d2=abs(15-16)=1
d=91

. m(19,1),n(2,19) d1=abs(19-2)=17 d2=abs(1-19)=18
d=1817

. This distance may be used to manage patterns like x,y.

```  * Iv distances descending method
```

Dieter: I don't know where this metric comes from but I have a few comments

• max(d1,d2)*min(d1,d2) can be simplified to d1*d2
• this distance is rather generous for points on the same line; one line further and the distance already doubles; a diagonal point is as remote as a 3 point jump
• technically, it is not a distance metric, as it doesn't satisfy the identity axiom (I was worried about the triangular inequality but that seems fine) and you should subtract 1 to get there

.
ruf012: Many Thanks

d1=abs(b1-b2)+1
d2=abs(c1-c2)+1

```  where this metric comes from
```

. d is only a simple distance of two points. No metric axioms. . I work with d, to manage patterns, here it is arised.
. example. corner.opening .
. All , , , answers in one directory d22.
. All , , , in directory d21.

. Probably other persons did the same.

```  can be simplified
```

. Indeed, if min in 0..9 this would be sufficient.
. But, if min in 10..19 a multiplication with 100 would be necessary
. To simplify the text, I made one string.

```the distance already doubles
```

. Points 33,44 and 44,55 with the same d, what else.

``` it is not a distance metric
```

. Correct, just a simple distance.

``` you should subtract 1
```