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

Re: tickets

Expand Messages
  • green8819
    Thanks Jack.
    Message 1 of 10 , Jun 27, 2013
    • 0 Attachment
      Thanks Jack.

      --- In libertybasic@yahoogroups.com, "paradisejb" <jburman1860@...> wrote:
      >
      >
      >
      > Slick! Nice approach. What we don't know from Jurgen is whether all his records are formatted exactly the same way, with the same number of elements in each record. He has not provided any data we can use to help solve his issue. The examples many have provided to this point do work when we run them, but, for some reason, they don't work for him. Something is missing. I hope your program solves his problem.
      >
      > --- In libertybasic@yahoogroups.com, "green8819" <green8819@> wrote:
      > >
      > > Hello Jurgen,
      > > Try the code below. If this is also NOT what you want, no problem, I had much fun doing it.
      > > You can continue posting your questions or comment by clicking "Reply".
      > > Thanks.
      > >
      > > '----code start
      > > dim dt$(99),nr$(99,7)
      > > today=date$("days")
      > > print "SAMPLE TICKETS:"
      > > for set=1 to 99
      > > print using("##",set);" ";
      > > dt$(set)=date$(today-set):print dt$(set);", ";
      > > for try=1 to 7
      > > [rndm]
      > > z=1+int(rnd(1)*45)
      > > for x=1 to 7
      > > if z=nr(x) then exit for
      > > next
      > > if x<7 then [rndm]
      > > nr(try)=z
      > > nr$=str$(nr(try)) :if nr(try)<10 then nr$="0"+nr$
      > > nr$(set,try)=nr$
      > > print nr$(set,try);
      > > if try<7 then print",";
      > > next :print
      > > next :print
      > > '-------------------------------------------------
      > > print "LAST 60 SETS, BoNuS NUMBER Removed:"
      > > z=0
      > > for x=99-59 to 99
      > > z=z+1
      > > print using("##",z);" ";
      > > print "set";using("##",x);" ";
      > > print dt$(x);", ";
      > > for y=1 to 6
      > > print nr$(x,y);
      > > if y<6 then print",";
      > > next
      > > print
      > > next
      > > END
      > > '----code end
      > >
      >
    • 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 2 of 10 , Jul 1, 2013
      • 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 3 of 10 , Jul 2, 2013
        • 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 4 of 10 , Jul 2, 2013
          • 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 5 of 10 , Jul 2, 2013
            • 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 6 of 10 , Jul 2, 2013
              • 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 7 of 10 , Jul 2, 2013
                • 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 8 of 10 , Jul 5, 2013
                  • 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.