I'm a programmer and I'm making an Artificial Intelligence for a boardgame called Hex. Since I am not that familiar with electrical engineering, I need your expertise on this subject.
I am now working on the evaluation function of the board. I have represented the board as a graph, since that is what a computer needs as input. But in this case you can also see it as an electrical circuit. The circuit usually looks like this, only then 11x11 hexagons:
The edges/resistors are all either 0,1 or INF (infinity).
My goal is to give a score to the board. I want to apply an electrical voltage to the two boundary opposite nodes and then check the total resistance between them.
I have made a possible scenario on a 2x2 board. The dots are nodes, the edges are resistors, the numbers the resitor values, and the arrows are my current-stream assumptions:
So the way I understand it is, I have to do something called nodal analysis. So i made for each node an equation where the voltage going in a node is the same as going out. So here are the equations I made:
$$V1 : \frac{(V1-V2)}{0} + \frac{(V1-V3)}{1} = 10 $$ (From what I understand the voltage source number doesn't matter so I picked 10).
$$V2:\frac{(V1-V2)}{0} = \frac{(V1-V3)}{1} + \frac{(V2-V4)}{1}$$
$$V3: \frac{V1-V3}{1} + \frac{(V2-V3)}{1} = \frac{(V3-V4)}{2} + \frac{(V3-V5)}{\infty}$$
$$V4: \frac{(V2-V4)}{1} + \frac{(V3-V4)}{2} = \frac{(V4-V5)}{\infty} + \frac{(V4-V6)}{1}$$
$$V5: \frac{(V3-V5)}{\infty} + \frac{(V4-V5)}{\infty} = \frac{(V5-V6)}{\infty}$$
$$V6: \frac{(V4-V6)}{1} + \frac{(V5-V6)}{\infty} = 10? $$ (I assume the current leaving out here is 10, but I'm not entirely sure)
So with some algebraic manipulations I put the numbers into a matrix, where the voltages are the variables ofcourse: (I also assumed dividing by zero is the same as multiplying by Infinity, I don't know if that is the correct way).
$$\infty -\infty -1 0 0 0 = 10$$
$$\infty -\infty 1 1 0 0 = 0$$
$$1 1 -2.5 0.5 0 0 = 0$$
$$0 1 0.5 -2.5 0 1 = 0$$
$$0 0 0 0 0 0 = 0 $$
$$0 0 0 1 0 -1 = 10 (?)$$
If you solve this you get:
$$V1: NaN $$
$$V2: NaN $$
$$V3: 0.05 $$
$$V4: 0.05 $$
$$V5: 0 $$
$$V6: -0.05$$
I have two questions now:
1.Where is my mistake in? (because I don't think voltages can be NaN or negative)
2.If I calculated these voltages correctly, how do I then compute the total resistance?

