Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

please help if ya can

0 views
Skip to first unread message

Sean

unread,
Mar 14, 2000, 3:00:00 AM3/14/00
to
Ok i'm making alittle app, and i have found something i can't figure a
good way to do. Below is a example of an array of Values.. I'm trying
to find a formula that will Lead me From the Value i'm at, to another
Value. For example.. A1[1] = 5646, A2[1] = 0
A1[545] = 2, A2[545] = 4536
A1[2] = 545, A2[545] = 0

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

Paul Martin

unread,
Mar 15, 2000, 3:00:00 AM3/15/00
to
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.

Sean <GG...@Home.com> wrote in message news:38cfba6a.7839808@news...

JSwing

unread,
Mar 15, 2000, 3:00:00 AM3/15/00
to
In article <gxDz4.27086$Dv1.3...@news1.rdc1.bc.home.com>, "Paul Martin" <joan...@home.com> wrote:
>Sean <GG...@Home.com> wrote in message news:38cfba6a.7839808@news...
>> Ok i'm making alittle app, and i have found something i can't figure a
>> good way to do. Below is a example of an array of Values.. I'm trying
>> to find a formula that will Lead me From the Value i'm at, to another
>> Value. For example.. A1[1] = 5646, A2[1] = 0
>> A1[545] = 2, A2[545] = 4536
>> A1[2] = 545, A2[545] = 0
>>
>> 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
>
>
>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).
>Paul.

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

Gerry Quinn

unread,
Mar 15, 2000, 3:00:00 AM3/15/00
to
In article <gxDz4.27086$Dv1.3...@news1.rdc1.bc.home.com>, "Paul Martin" <joan...@home.com> wrote:

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.
>

Sean

unread,
Mar 15, 2000, 3:00:00 AM3/15/00
to
thanks for the info, I'm in looking into those searches right now..
Anymore help would be great. i've been trying to get this formula for
days now. This is how i'm trying to do it.. I"LL EVEN SEND MONEY!
hehe j/j. plz help.
I'm trying to find a formula that will plot. a path.. ex. you are in
sector 1 and want to goto sector 4235
1
53
434
23
4235

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:

0 new messages