i'm trying to make a formula that will plot a path from say 545 to 1
below is a example how it would look if i ploted it out on paper.
A1[1] leads to A1[5646] leads to A1[78].. etc. If you understand what
i'm trying to figure out and can help please do. Thanks a million.
1
\
274 5646
\ /
567 - 833 78 - 896 2742
\ | |
2343 46 563 - 324
/ \ | /
646 4536 - 54
/ | \
545 435 767
|
2
Sean <GG...@Home.com> wrote in message news:38cfba6a.7839808@news...
I'm certainly no coding expert, but it looks like you're mixing data with data
structure. The difference between the value of a playing card and its position
in a shuffled deck. They both might be important, but rarely will they be
treated in the same way (or even mix).
If you were looking for a dynamic data structure where the connections can be
moved around easily (i.e. changing node 1 to point at 274 instead of 5646) you
might not want to use an array.
JSwing
The algorithm you need is the usual Dijkstra / wavefront / A* algorithm
for finding the shortest path. Do a search and you will find resources
explaining it.
The data representation you are using is not very suitable unless you
have few nodes, each with many paths. If there are many nodes with
few paths you will have a huge matrix with nearly all the entries
being zero. But that should not affect your choice of algorithm - you
can still implement the standard technique.
Gerry Quinn
--
http://bindweed.com
Puzzle / Strategy Games and Kaleidoscope for Windows
Download evaluation versions free, no time limits
Try our new adware game "Skeet Shooting"
>I don't have any references handy, but you can use a tree representation to
>represent this data (a binary tree will suffice for the example you have
>below).
>You can then do a simple 'tree walk' starting at your 'from' value, until
>you end up at your 'to' value.
>It's hard to say exactly what you're trying to do without getting more
>information from you, but as a first guess, I think this is the problem
>you're looking at.
>Paul.
>
This is how I have it now, if anyone can help plz do.
-Each Sector has a group of SectorLinks that lead to other sectors and
so on. I'm trying to plot a path threw all this.. All i Know is
what sector i'm in. what Links are in that sector and the sector i'm
going to.
If i wanted to go back and forward, from sector 1 to 2 i would take
sectorlink 4 to sector 2 then sectorlink 3 to get back to sector 1.
SectorLink1[1] = 4
SectorLink2[1] = 53
SectorLink3[1] = 621
SectorLink4[1] = 2
SectorLink5[1] = 3634
SectorLink6[1] = 83
SectorLink1[2] = 81
SectorLink2[2] = 624
SectorLink3[2] = 1
SectorLink4[2] = 546
SectorLink5[2] = 4334
SectorLink6[2] = 0
SectorLink1[3] = ......
SectorLink1[4334] = 856
SectorLink2[4334] = 1543
SectorLink3[4334] = 3455
SectorLink4[4334] = 2456
SectorLink5[4334] = 956
SectorLink6[4334] = 2
4 83
| /
621 - 1 - 3634
| \
23 2 - 81 856
/ | \ /
546 624 4334 - 1543
/ | \
3455 956 2456
ex. one of the sector links for sector 4 will lead to 1 and one
sector link in sector 23 will lead to 1 and so on..
On Wed, 15 Mar 2000 03:34:36 GMT, "Paul Martin" <joan...@home.com>
wrote: