Loading ...
Sorry, an error occurred while loading the content.

Re: tickets

Expand Messages
  • jurgen
    Thanks green8819 I shall see if I can use it . What I wanted was to read a list with all the tickets from the lottery Here it s named LottoGameData.csv I want
    Message 1 of 10 , Jul 1 3:21 AM
    • 0 Attachment
      Thanks green8819
      I shall see if I can use it .
      What I wanted was to read a list with all the tickets from the lottery
      Here it's named LottoGameData.csv
      I want to print only the last 60 tickets without bonus nr because then I can load this in my program.

      example original line
      06/04/2013;1;10;18;21;31;37;11

      What I realy like is this where T$(1) is the most recent ticket and T$(60) is 60 drawings away

      example:

      T$(60) = " 01 10 18 21 31 37"
    • Rod
      This is how I would go about it. I may have a bug or two in it but the general principle works. Use the debugger to step through and understand what is going
      Message 2 of 10 , Jul 2 2:33 AM
      • 0 Attachment
        This is how I would go about it. I may have a bug or two in it but the general principle works. Use the debugger to step through and understand what is going on.

        'create some dummy data with raising number 1-99
        open "ticket.csv" for output as #1
        for n= 1 to 99
        print #1, "06/04/2013;1;10;18;21;31;"+str$(n)+";11"
        next
        close #1

        'count number of tickets
        open "ticket.csv" for input as #1
        while not(eof(#1))
        line input #1, nul$
        i=i+1
        wend
        close #1

        'discard the ones you dont want
        open "ticket.csv" for input as #1
        for n= 1 to i-60
        line input #1, nul$
        next

        'grab the ones you do
        dim t$(60)
        for n = 60 to 1 step -1
        line input #1, t$(n)
        next

        for n= 1 to 60
        print t$(n)
        next



        --- In libertybasic@yahoogroups.com, "jurgen" <dovejurgen@...> wrote:
        >
        > Thanks green8819
        > I shall see if I can use it .
        > What I wanted was to read a list with all the tickets from the lottery
        > Here it's named LottoGameData.csv
        > I want to print only the last 60 tickets without bonus nr because then I can load this in my program.
        >
        > example original line
        > 06/04/2013;1;10;18;21;31;37;11
        >
        > What I realy like is this where T$(1) is the most recent ticket and T$(60) is 60 drawings away
        >
        > example:
        >
        > T$(60) = " 01 10 18 21 31 37"
        >
      • paradisejb
        Here s a way to strip the last digits from the tickets. It can be added to the end of Rod s code. for n= 1 to 60 l=len(t$(n)) while right$(t$(n),1) ; l=l-1
        Message 3 of 10 , Jul 2 8:36 AM
        • 0 Attachment
          Here's a way to strip the last digits from the tickets. It can be added to the end of Rod's code.

          for n= 1 to 60
          l=len(t$(n))
          while right$(t$(n),1)<>";"
          l=l-1
          t$(n)=left$(t$(n),l)
          wend
          print left$(t$(n),l-1)
          next n


          --- In libertybasic@yahoogroups.com, "Rod" <rodbird@...> wrote:
          >
          > This is how I would go about it. I may have a bug or two in it but the general principle works. Use the debugger to step through and understand what is going on.
          >
          > 'create some dummy data with raising number 1-99
          > open "ticket.csv" for output as #1
          > for n= 1 to 99
          > print #1, "06/04/2013;1;10;18;21;31;"+str$(n)+";11"
          > next
          > close #1
          >
          > 'count number of tickets
          > open "ticket.csv" for input as #1
          > while not(eof(#1))
          > line input #1, nul$
          > i=i+1
          > wend
          > close #1
          >
          > 'discard the ones you dont want
          > open "ticket.csv" for input as #1
          > for n= 1 to i-60
          > line input #1, nul$
          > next
          >
          > 'grab the ones you do
          > dim t$(60)
          > for n = 60 to 1 step -1
          > line input #1, t$(n)
          > next
          >
          > for n= 1 to 60
          > print t$(n)
          > next
          >
          >
          >
          > --- In libertybasic@yahoogroups.com, "jurgen" <dovejurgen@> wrote:
          > >
          > > Thanks green8819
          > > I shall see if I can use it .
          > > What I wanted was to read a list with all the tickets from the lottery
          > > Here it's named LottoGameData.csv
          > > I want to print only the last 60 tickets without bonus nr because then I can load this in my program.
          > >
          > > example original line
          > > 06/04/2013;1;10;18;21;31;37;11
          > >
          > > What I realy like is this where T$(1) is the most recent ticket and T$(60) is 60 drawings away
          > >
          > > example:
          > >
          > > T$(60) = " 01 10 18 21 31 37"
          > >
          >
        • Lorne Russell
          Here’s how I would do it: for n=1 to 60 for x=len(t$(n)) to 1 step -1 if mid$(t$(n),x,1)= ; then t$(n)=left$(t$(n),x-1) : print t$(n) : EXIT FOR next x next
          Message 4 of 10 , Jul 2 8:54 AM
          • 0 Attachment
            Here’s how I would do it:

            for n=1 to 60
            for x=len(t$(n)) to 1 step -1
            if mid$(t$(n),x,1)=";" then t$(n)=left$(t$(n),x-1) : print t$(n) : EXIT FOR
            next x
            next n

            Lorne Russell


            From: paradisejb
            Sent: Tuesday, July 02, 2013 8:36 AM
            To: libertybasic@yahoogroups.com
            Subject: [libertybasic] Re: tickets




            Here's a way to strip the last digits from the tickets. It can be added to the end of Rod's code.

            for n= 1 to 60
            l=len(t$(n))
            while right$(t$(n),1)<>";"
            l=l-1
            t$(n)=left$(t$(n),l)
            wend
            print left$(t$(n),l-1)
            next n

            --- In mailto:libertybasic%40yahoogroups.com, "Rod" <rodbird@...> wrote:
            >
            > This is how I would go about it. I may have a bug or two in it but the general principle works. Use the debugger to step through and understand what is going on.
            >
            > 'create some dummy data with raising number 1-99
            > open "ticket.csv" for output as #1
            > for n= 1 to 99
            > print #1, "06/04/2013;1;10;18;21;31;"+str$(n)+";11"
            > next
            > close #1
            >
            > 'count number of tickets
            > open "ticket.csv" for input as #1
            > while not(eof(#1))
            > line input #1, nul$
            > i=i+1
            > wend
            > close #1
            >
            > 'discard the ones you dont want
            > open "ticket.csv" for input as #1
            > for n= 1 to i-60
            > line input #1, nul$
            > next
            >
            > 'grab the ones you do
            > dim t$(60)
            > for n = 60 to 1 step -1
            > line input #1, t$(n)
            > next
            >
            > for n= 1 to 60
            > print t$(n)
            > next
            >
            >
            >
            > --- In mailto:libertybasic%40yahoogroups.com, "jurgen" <dovejurgen@> wrote:
            > >
            > > Thanks green8819
            > > I shall see if I can use it .
            > > What I wanted was to read a list with all the tickets from the lottery
            > > Here it's named LottoGameData.csv
            > > I want to print only the last 60 tickets without bonus nr because then I can load this in my program.
            > >
            > > example original line
            > > 06/04/2013;1;10;18;21;31;37;11
            > >
            > > What I realy like is this where T$(1) is the most recent ticket and T$(60) is 60 drawings away
            > >
            > > example:
            > >
            > > T$(60) = " 01 10 18 21 31 37"
            > >
            >





            [Non-text portions of this message have been removed]
          • paradisejb
            These things are always so interesting. I thought Lorne s solution looked very efficient, so I timed both ways to see any difference. Surprisingly, both
            Message 5 of 10 , Jul 2 12:49 PM
            • 0 Attachment
              These things are always so interesting. I thought Lorne's solution looked very efficient, so I timed both ways to see any difference. Surprisingly, both methods took about the exact same time; around 355-361 ms after three passes each. (That's for the routine to remove the bonus numbers only.)

              --- In libertybasic@yahoogroups.com, "Lorne Russell" <lorneokb@...> wrote:
              >
              > Here’s how I would do it:
              >
              > for n=1 to 60
              > for x=len(t$(n)) to 1 step -1
              > if mid$(t$(n),x,1)=";" then t$(n)=left$(t$(n),x-1) : print t$(n) : EXIT FOR
              > next x
              > next n
              >
              > Lorne Russell
              >
              >
              > From: paradisejb
              > Sent: Tuesday, July 02, 2013 8:36 AM
              > To: libertybasic@yahoogroups.com
              > Subject: [libertybasic] Re: tickets
              >
              >
              >
              >
              > Here's a way to strip the last digits from the tickets. It can be added to the end of Rod's code.
              >
              > for n= 1 to 60
              > l=len(t$(n))
              > while right$(t$(n),1)<>";"
              > l=l-1
              > t$(n)=left$(t$(n),l)
              > wend
              > print left$(t$(n),l-1)
              > next n
              >
              > --- In mailto:libertybasic%40yahoogroups.com, "Rod" <rodbird@> wrote:
              > >
              > > This is how I would go about it. I may have a bug or two in it but the general principle works. Use the debugger to step through and understand what is going on.
              > >
              > > 'create some dummy data with raising number 1-99
              > > open "ticket.csv" for output as #1
              > > for n= 1 to 99
              > > print #1, "06/04/2013;1;10;18;21;31;"+str$(n)+";11"
              > > next
              > > close #1
              > >
              > > 'count number of tickets
              > > open "ticket.csv" for input as #1
              > > while not(eof(#1))
              > > line input #1, nul$
              > > i=i+1
              > > wend
              > > close #1
              > >
              > > 'discard the ones you dont want
              > > open "ticket.csv" for input as #1
              > > for n= 1 to i-60
              > > line input #1, nul$
              > > next
              > >
              > > 'grab the ones you do
              > > dim t$(60)
              > > for n = 60 to 1 step -1
              > > line input #1, t$(n)
              > > next
              > >
              > > for n= 1 to 60
              > > print t$(n)
              > > next
              > >
              > >
              > >
              > > --- In mailto:libertybasic%40yahoogroups.com, "jurgen" <dovejurgen@> wrote:
              > > >
              > > > Thanks green8819
              > > > I shall see if I can use it .
              > > > What I wanted was to read a list with all the tickets from the lottery
              > > > Here it's named LottoGameData.csv
              > > > I want to print only the last 60 tickets without bonus nr because then I can load this in my program.
              > > >
              > > > example original line
              > > > 06/04/2013;1;10;18;21;31;37;11
              > > >
              > > > What I realy like is this where T$(1) is the most recent ticket and T$(60) is 60 drawings away
              > > >
              > > > example:
              > > >
              > > > T$(60) = " 01 10 18 21 31 37"
              > > >
              > >
              >
              >
              >
              >
              >
              > [Non-text portions of this message have been removed]
              >
            • green8819
              Alright. I see an abundance of talent in devising ways of stripping . How about stripping and assembly? You strip away unlikely numbers and assemble likely
              Message 6 of 10 , Jul 2 8:34 PM
              • 0 Attachment
                Alright. I see an abundance of talent in devising ways of 'stripping'. How about stripping and assembly? You strip away unlikely numbers and assemble likely numbers into a Pool. From which you create about 30 sets, each set consisting of 7 numbers. If any of your set matches the Lucky Set announced in a publicly-held Lottery Draw, you win the Jackpot.

                Sounds easy? It is. Unfortunately, whether your scheming idea showers fortune for you depends on the Almighty God's 'scheme of things'. That is the difficult part.

                While I wait for the unseen helping hand, I can try on my own, at least for the fun of it. Besides, people say God helps those who help themselves.

                Mike's Lot. Coming soon.

                Any contestants? Sarmed? Henrik?
              • jurgen
                This code is working.Thanks everyone But if you can do something like this it s even better. T$(60) = 01 10 18 21 31 37 create some dummy data with raising
                Message 7 of 10 , Jul 5 3:56 AM
                • 0 Attachment
                  This code is working.Thanks everyone
                  But if you can do something like this it's even better.
                  T$(60) = " 01 10 18 21 31 37"


                  'create some dummy data with raising number 1-99

                  'count number of tickets
                  open "C:LottoGameData.csv" for input as #1
                  while not(eof(#1))
                  line input #1, nul$
                  i=i+1
                  wend
                  close #1

                  'discard the ones you dont want
                  open "C:LottoGameData.csv" for input as #1
                  for n= 1 to i-60
                  line input #1, nul$
                  next

                  'grab the ones you do
                  dim t$(60)
                  for n = 60 to 1 step -1
                  line input #1, t$(n)
                  next

                  for n= 1 to 60
                  l=len(t$(n))
                  while right$(t$(n),1)<>";"
                  l=l-1
                  t$(n)=left$(t$(n),l)
                  wend
                  print left$(t$(n),l-1)
                  next n

                  close #1
                Your message has been successfully submitted and would be delivered to recipients shortly.