Lottery analysis - Counting the quantity and size of "blocks" of "hits" in a 7x7 Grid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jacko1953
    New Member
    • May 2014
    • 14

    Lottery analysis - Counting the quantity and size of "blocks" of "hits" in a 7x7 Grid

    Hi, I am using Visual Basic 5 Learner's edition on a HP envy laptop running Windows 7.

    I have written some fairly unsophisticated , but quite useful routines for my personal analysis of the UK 6 from 49 lottery.

    For my purposes I have created a 7x7 "grid" consisting of an array of labels (i.e. label1(0) to Label1(48) and have written code to analyse various properties of the patterns generated in each game.

    I am only looking at the main numbers, which I visualise on the grid by assigning a vbred backcolor property to each of the selected numbers. (see attachment)

    I had thought that counting the number and size of the "blocks" ie highlighted numbers adjacent, in this case, only 2 Blocks, 1 of 5 squares and 1 of 1, would be fairly straightforward , but I am completely stymied.

    I have used grids with arrays and without arrays, with extended arrays and with many types of sub-routines utilizing the backcolor property,and invoking other properties, and then analysing the surrounding squares of each selected number, but in the end I have been unable to differentiate between the separate blocks.

    I only end up drawing flow diagrams which when coded, work fine to a degree, but ultimately fail to differentiate one block from another. Any help would be greatly appreciated.
  • Jacko1953
    New Member
    • May 2014
    • 14

    #2
    Problem solved

    Hi, just to announce that I solved the problem myself. I dispensed with the label array and created a grid of labels 1 to 49 which simplified things somewhat. I then created 6 variables for counting the blocks of numbers, and used the datechanged property of a textbox to increment the variables, hence counting the size of each block. A little clumsy, but effective.

    Comment

    • Jacko1953
      New Member
      • May 2014
      • 14

      #3
      Problem not solved!

      Ooops - ultimately that didn't work. I really would appreciate some help here please. All I want to know is to how to count the sizes and quantity of "blocks" of numbers on the results grid!
      For example the numbers 4, 11 and 19 would count as one block of three, while 26, 28 and 34 would also count as one block of three, giving two blocks of 3 numbers each. the numbers 4, 13, 30, 39, 48 and 49 would give 5 blocks, etc. Perhaps I was not explicit previously.
      Last edited by Jacko1953; Sep 28 '14, 02:28 PM. Reason: afterthought

      Comment

      • drmdrm
        New Member
        • Jan 2012
        • 1

        #4
        For simple detection on random process - like lottery will be better to sort results on 1st step and after count/filter them on 2nd step.
        Wherever sort will give you quick rule than each next number from results are bigger (easy to use in loops)- imho is more better tools than VB (example AWK) to quite easier solve such things ;)
        Last edited by drmdrm; Sep 28 '14, 04:12 PM. Reason: reedit

        Comment

        • Jacko1953
          New Member
          • May 2014
          • 14

          #5
          Thanks drmdrm for your reply. I've had no problem with other filters in vb5, and this is the only remaining block i've come up against. I did write code to sort the results first, and this process i'm trying to do is the 2nd step. As with many other parameters, like odds/evens, decades, number sums etc., I believe that the number and size of blocks in each draw's unique grid pattern will follow a Bell curve, with 3,1,1,1 and 3,2,1 for example being very common It is these statistics from each draw which I wish to gather and analyse. Having used VB5 to study these patterns graphically, I'm reluctant to turn to another programming solution, hence my appeal for vb5 expertise. Hope this clarifies a little.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            I have no idea how you arrived at your counts. Please explain in more detail.

            Comment

            • Jacko1953
              New Member
              • May 2014
              • 14

              #7
              Hello Rabbit, I took a sample of 500 or so draws of the UK 6 from 49 Lotto. I keep the entire draw history on printed arrays of 7x7 grids so that I can analyse the patterns using various parameters.
              Of the 1000 I randomly selected, I found that 18% of the draws' numbers were grouped on the grid into three discrete blocks, 40% had 4 blocks of numbers and 26% had 5 blocks, accounting for 84% of draws. I wish to use VB5 to analyse the complete draw history looking at these patterns for each individual draw with a view to creating filters. There are, of course many other ways of classifying the 7x7 grid patterns. This is the only one I have had trouble coding, the problem arising when I try to differentiate the groups. The groups of course can be from 1 which is very rarely found, to 6 where each number is separated from each other by a minimum of one square diagonally, vertically or horizontally.

              I was counting the number of members of eacht group using my VB5 program designating them GroupSize, and then trying to count the number of groups using the variable GroupQuantity, but somewhere in my loops and subroutines, the GroupQuantity variable got scrambled.

              I did away with label arrays and merely named the number labels Label1 to Label49 and worked sequentially through the labels, which were coded to show background VBred colour to designate the "hits" for each draw record.

              Imagine that the results for a particlar draw were 1,9,16,22,40 and 49.

              My program would read label1 find it's backcolour VBRed and thus assign it GroupSize1=1, GroupQuantity=1 , then seeing that numbers 2 and 8 were VBwhite backcolour, would reach label9 before incrementing GroupSize to 2, leaving Quantity with value 1. The program would then analyse the labels surrounding Label9 in a simalar fashion, eventually incrementing the first GroupSize to 4 and GroupQuantity remaining at 1 until it reached 40 when it should reach GroupQuantity =2 and 49 where the GroupQuantity should read 3 and the GroupSizes would be 4,1,1 respectively. For some reason though the variables would mess up. I tried stepping the code, but got hopelessly confused. I felt I was so near many times, but my code always let me down.

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                The missing piece was that a group is defined by a string of numbers connected in any direction without a gap.

                Can you post your code that is closest to the solution you are looking for? We can try to diagnose where you went awry.

                Comment

                • twinnyfo
                  Recognized Expert Moderator Specialist
                  • Nov 2011
                  • 3662

                  #9
                  Yes... No attachments (from post #1) or any code keeps us in the dark about what solution you are actually trying to work on.

                  Comment

                  • Jacko1953
                    New Member
                    • May 2014
                    • 14

                    #10
                    Sorry twinnyfo, I thought I had attached picture of form to post#1. I also thought I had replied to Rabbit's post enclosing code. I must be doing something wrong.

                    Comment

                    • twinnyfo
                      Recognized Expert Moderator Specialist
                      • Nov 2011
                      • 3662

                      #11
                      In your reply, click on the "[ CODE / ]" button. Inserting your code between the Braces "][" and it will display properly.

                      Typing "[ CODE ]This is Code[ /CODE ]" (I have to add spaces so the forum does not read it as a code tag)

                      Will produce this:

                      Code:
                      This is Code
                      Also, for screenshots, it's best to embed in a word doc, as resolution is limited for images here.

                      Comment

                      • Jacko1953
                        New Member
                        • May 2014
                        • 14

                        #12
                        Thanks for your patience - I'll try that.

                        Comment

                        • Jacko1953
                          New Member
                          • May 2014
                          • 14

                          #13
                          My Code

                          Had trouble submitting code within this window , so have tried adding as attachment....
                          Attached Files

                          Comment

                          • twinnyfo
                            Recognized Expert Moderator Specialist
                            • Nov 2011
                            • 3662

                            #14
                            No wonder you couldn't add the code in the code tags--this is hundreds of pages!

                            Comment

                            • twinnyfo
                              Recognized Expert Moderator Specialist
                              • Nov 2011
                              • 3662

                              #15
                              Wow! So, my first question is to piggy back on Rabbit's Post #8: You are trying to determine if lottery picks tend to fall within blocks (blocks defined as two numbers falling within your grid in adjacent "cells"). For example in a 3x3 grid, assuming number 5 is selected, any other number in that 3x3 grid meets the criteria? I'm just trying to understand what you are shooting for, first.

                              Code:
                              X O O
                              O X O
                              O O O
                              Second, from a coding standpoint, your code looks more like 100's of pages of cut-and-paste of the same code, with just the numerical values changed. I admit, I gave up after the first few pages and just scanned........ . Assuming your method of looking at the values is correct, there must be a better way of doing it than what you have!

                              Third, to give you an alternate way of looking at things, if there are 49 numbers (7x7), and you are looking at your numbers based on this 7x7 grid, then why not calculate your data via rows and columns? If the answer to my first question was correct (numbers falling within the same block), then the evaluation for such a case becomes much more simplified:

                              Use a boolean Array [fArray(7,7)] which corresponds to the seven rows and seven columns. A True value in the array indicates that number was picked. So, for example, the number 24 would be represented by a "True" value in fArray(4,3)--fourth row, third column [21 values in the first three rows, 22, 23, 24--hence twinnyfo!].

                              Let's assume the number picked is in row X, column Y (it doesn't matter the actual value of the number, because we are looking at rows and columns.

                              So, if the number is identified as fArray(X, Y), then another value within the corresponding "block" would be any values that meet the following Criteria: (X-1, Y-1) through (X+1, Y+1):

                              Code:
                              X-1,Y-1 | X-1,Y | X-1,Y+1
                              --------|-------|--------
                               X,Y-1  |  X,Y  |  X,Y+1
                              --------|-------|--------
                              X+1,Y-1 | X+1,Y | X+1,Y+1
                              This would streamline the logic behind your process tremendously!

                              Just a thought!

                              Comment

                              Working...