multigraph or other solution?
suppose i have a graph with 3 nodes like:
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
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
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
thanks
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
Stella SDK 2: Enhanced Objective-C for Android solution | Max.M.T | 0 | 2,021 |
Aug 30, 2013 10:42 AM Last Post: Max.M.T |