locked
small basic RRS feed

  • Question

  • Hello, I am new to Small Basic and saw the posting for 2 lottery number generator programs.  I was wondering if SB was able to handle the input and storing of daily, already drawn numbers, then based on that stored data, generate different reports such as what numbers repeat the most-least, combination of numbers,  and similar manipulation of the input data?

    Sunday, September 4, 2011 2:48 PM

Answers

  • Depending on how you wish to manipulate(input/output) the data, you would combine multiple objects (Array, Text, File, etc)
    'sample data
    winning3Digit = "1=198;2=574;3=552;4=802;5=235;6=570;7=485;8=025;9=193;"
    
    'my counts of the sample data, to test against the algorithm
    mycounts = "0=3;1=2;2=4;3=2;4=2;5=7;6=0;7=2;8=3;9=2;"
    

    getDigitCounts() TextWindow.WriteLine("") TextWindow.WriteLine(mycounts) TextWindow.WriteLine(count) 'creates an array showing the frequency each digit appears
    Sub getDigitCounts For i = 0 To 9 For n = 1 To Array.GetItemCount(winning3Digit) 'count how many times the digit appears in the current winning number(n) For check = 1 to 3 If (Text.GetSubText(winning3Digit[n],check,1)= i) Then count[i] = count[i] + 1 EndIf EndFor EndFor 'check to see if the arrayitem is null, give it a value of zero if it is If (count[i] = "") Then count[i] = 0 EndIf EndFor EndSub

    • Edited by Rushworks Monday, September 5, 2011 5:20 PM
    • Marked as answer by litdev Thursday, September 8, 2011 5:47 PM
    Monday, September 5, 2011 5:18 PM

All replies

  • Yup!
    ~~AirWaves!!~~
    Sunday, September 4, 2011 5:43 PM
  • Thanks...using the Array command?
    Monday, September 5, 2011 2:55 PM
  • Depending on how you wish to manipulate(input/output) the data, you would combine multiple objects (Array, Text, File, etc)
    'sample data
    winning3Digit = "1=198;2=574;3=552;4=802;5=235;6=570;7=485;8=025;9=193;"
    
    'my counts of the sample data, to test against the algorithm
    mycounts = "0=3;1=2;2=4;3=2;4=2;5=7;6=0;7=2;8=3;9=2;"
    

    getDigitCounts() TextWindow.WriteLine("") TextWindow.WriteLine(mycounts) TextWindow.WriteLine(count) 'creates an array showing the frequency each digit appears
    Sub getDigitCounts For i = 0 To 9 For n = 1 To Array.GetItemCount(winning3Digit) 'count how many times the digit appears in the current winning number(n) For check = 1 to 3 If (Text.GetSubText(winning3Digit[n],check,1)= i) Then count[i] = count[i] + 1 EndIf EndFor EndFor 'check to see if the arrayitem is null, give it a value of zero if it is If (count[i] = "") Then count[i] = 0 EndIf EndFor EndSub

    • Edited by Rushworks Monday, September 5, 2011 5:20 PM
    • Marked as answer by litdev Thursday, September 8, 2011 5:47 PM
    Monday, September 5, 2011 5:18 PM
  • Thankyou
    Tuesday, September 6, 2011 3:07 PM