iDevGames Forums

Full Version: multigraph or other solution?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
suppose i have a graph with 3 nodes like:
[Image: Multigraph_1000.gif]
that form a boardgame.
every edge has a color.
a pawn can move from node to node accordingly to a color from a dice roll.

i don't know where to start implementing this, or if there is a easy solution for this problem, perhaps i can add nodes between edges giving weight 0.5 instead of 1, but i didn't like that solution because the added nodes are not playable nodes (but only support to arrive at the legal node)

can someone give me an hint?
thanks
How about this:
Assign each colour a power of 2 number, e.g. red = 1, green = 2, blue = 4.
For each node you can store its connections to each of the other nodes in an eight bit number, e.g.:
Node A : b=5, c=7
Node B : a=5, c=2
Node C : a=7, b=2
Now if you are at node A and you roll green (2) you can say:
2 | 5 = 0 so you can't go to node B
2 | 7 = 2 so you can go to node C
seem a nice solution!
thanks
Reference URL's