How are arrays used?


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Use a bit array instead of whole bytes
    Nice idea

    Quote Originally Posted by skimask View Post
    The only problem with this is you'll have to use 2 random numbers, one to pick which letter, and one to pick which number 'inside' that letter...
    Not really, if there are 10 possible numbers for each letter. Use random number between 0 and 59. Then "tens" place becomes B·I·N·G·O (0·1·2·3·4·5), and the "ones" place becomes 1·2·3·...9·10. The algorithm would just need to add 1 to the the value. If there are more than 10 numbers for each letter, then it changes things. I just can't remember how many numbers each letter has. If it is a multiple of 10, you can extend the concept, so 0-19 is B1-B20, 20-39 is I1-I20, etc.

    Extending your idea further, you could use an array of bytes, that will encompass all possible numbers. If there are 6*30=180 possibilites, use:

    Total var BYTE[23] '180+4

    This puts all the possibilities in one continious block.
    Then, with one random number you can access an individual bit with

    Total.0(bit) 'Where bit is a number between 0 and 179, for 180 possible options. Here's the explaination for those who need it.

    Then code the algorithm to 'interpert' the bit as B5, I2, N7, etc.

    SteveB
    Last edited by SteveB; - 31st May 2007 at 02:26.

  2. #2
    Join Date
    Dec 2005
    Location
    Hendersonville NC
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Bingo

    My thanks to Skimask and Steve B for their advice. For Bingo, there really is no need to use the letters. Each letter has 15 places, i.e. B goes from 1 to 15, I goes from 16 to 30, N 31 to 45, G 46 to 60, and finally O from 61 to 75. Of course, as with any other problem, there are probably a lot of ways to do the program, but I like the idea of bit arrays and will try to experiment with it.

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 08:55
  2. Beginner trying to use arrays
    By captain in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 3rd November 2007, 08:20
  3. How to use Arrays Using Pic Basic Pro(need help)
    By MrSafe in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 17th July 2007, 22:56
  4. SerOut and Arrays
    By shawn in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th July 2005, 18:32
  5. storing arrays and reading arrays
    By Yue in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th March 2004, 23:03

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts