RE: Need help to write routine - Please

new topic     » goto parent     » topic index » view thread      » older message » newer message

Wow absolutly brilliant - thankyou
I ponder this for hours and you give it to me in 10 lines, I'm impressed

Regards
Tony Steward


Juergen Luethje wrote:
> 
> 
> Tony wrote:
> 
> > Hello all,
> > Firstly thanks in advance to anyone who may be able to help.
> > I need help writing a routine. My main problem is that data may vary
> > greatly. This is to help me with a master key program (I am a locksmith)
> > so if anyone can spare a little time I would appreciate it.
> >
> > Firstly lets start with the sequence of 0 5 3 4 1 1 - This is not a
> > number but individual characters, it could just as easily be alpha
> > characters. The length of this sequence may be anything from 4 to 12
> > characters.
> > Next I specify the parts of the sequence that will change.
> >
> > 0 5 3 4 1 1
> >   X   X
> >
> > X indicates the column to change.
> > I then create a list of characters to change. Again the number of
> > columns to change may vary from 1 to all.
> >
> > 0 5 3 4 1 1
> >   X   X
> >   1   0
> >   3   2
> >   7   6
> >   9   8
> >
> > Now the routine needs to calculate the new sequences.
> > Which are:
> > 0 1 3 0 1 1
> > 0 1 3 2 1 1
> > 0 1 3 6 1 1
> > 0 1 3 8 1 1
> > 0 3 3 0 1 1
> > 0 3 3 2 1 1
> > 0 3 3 6 1 1
> > 0 3 3 8 1 1
> > 0 7 3 0 1 1
> > 0 7 3 2 1 1
> > 0 7 3 6 1 1
> > 0 7 3 8 1 1
> > 0 9 3 0 1 1
> > 0 9 3 2 1 1
> > 0 9 3 6 1 1
> > 0 9 3 8 1 1
> >
> > Note the first sequence changes both columns but after that only one
> > column changes at a time.
> >
> > I'll also show you part of another series if three columns were to be
> > changed:
> > 0 5 3 4 1 1
> >   X   X X
> >   1   0 3
> >   3   2 5
> >   7   6 7
> >   9   8 9
> >
> > Now the routine needs to calculate the new sequences.
> > Which are:
> > 0 1 3 0 3 1
> > 0 1 3 0 5 1
> > 0 1 3 0 7 1
> > 0 1 3 0 9 1
> > 0 1 3 2 3 1
> > 0 1 3 2 5 1
> > 0 1 3 2 7 1
> > 0 1 3 2 9 1
> > 0 1 3 6 3 1
> > 0 1 3 6 5 1
> > 0 1 3 6 7 1
> > 0 1 3 6 9 1
> > 0 1 3 8 3 1
> > 0 1 3 8 5 1
> > 0 1 3 8 7 1
> > 0 1 3 8 9 1
> > 0 3 3 0 3 1
> > 0 3 3 0 5 1
> > 0 3 3 0 7 1
> > 0 3 3 0 9 1
> > and so on
> > As you can see when changing more columns more sequences are possible.
> >
> > Thanks,
> >
> > Tony Steward
> 
> This seems to work as expected:
> 
> --------------------=-----------------------------=--------------------
> sequence mainSequence, positionsToChange, newValues
> integer Level
> 
> procedure change ()
>    for posn = 1 to length(newValues[Level]) do
>       mainSequence[positionsToChange[Level]] = newValues[Level][posn]
>       if Level < length(positionsToChange) then
<snip>



Give your hardest tasks to your lasiest workers. 
They will always find the easiest way to complete it.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu