hex grid output

Back to General discussions forum

Goodwin Lu     2020-06-12 15:24:37

I tried figuring out the solution using the equation (x-1)^2 +y^2=1 and x^2+y^2 = 1 which resulted in x=1/2 and y = sqrt(3)/2. But when I used this in my logic I still didn't get the right answer. Any insight?

sontran     2020-06-15 07:02:21

Try input = "A", "B", "C", etc. All the answers should be 1.

Goodwin Lu     2020-06-15 18:35:57

A and D had 1 and -1 respectively, it seems that only when you combine multiple, the results become crazy

sontran     2020-06-15 18:48:25

For simplest input:

6
A
B
C
D
E
F

What does your code output?

Goodwin Lu     2020-06-15 19:58:01

dang! you're right. I declared xdist and ydist wrong. thanks for the help.

Please login and solve 5 problems to be able to post at forum