0
$\begingroup$

I'm building a bingo game and I'm stuck on how check if two bingo cards randomly generated are different. Each card corresponds to a 3x9 matrix with four zeroes on each row (lets say they are empty):

example of my bingo card

I've been thinking on separate each three columns, so I would have three 3x3 matrixes, and check their modules, but don't like it because there could be matrixes with same values but distinct order and same modules that would be treaten as if they were the same.

Which would be the best appproach to this topic?

  • 0
    I'm confused. What's wrong with checking all the entries? Is it a matter of efficiency?2017-02-11
  • 0
    No, it's just that I've to be sure that all generated cards are different2017-02-11
  • 0
    Note that on actual bingo cards, the entries are already in sorted order, so that having the "same values but distinct order" cannot present a difficulty.2017-02-11
  • 0
    Please clarify "that all generated cards are different". As stated the Question presently asks only about determining if *two* cards are different.2017-02-11
  • 0
    To be honest I'm still very confused. "Two" and "all" might coincide, but the wording suggests they do not. Also, are you asking for an algorithm? Mathematically there isn't much going on here.2017-02-11
  • 0
    Hmmm thats a good point... what if I set weights for each cell and store the sumatory of each cell value by its weight?2017-02-11
  • 1
    Are you asking for an algorithm so that the generated cards are distinct *beforehand*? Or instead, once cards are generated, how to distinguish them?2017-02-11
  • 0
    "what if I set weights for each cell and store the sumatory of each cell value by its weight?" The general scheme of such computations is called a [Hash function](https://en.wikipedia.org/wiki/Hash_function). One then compares the hash values of cards, and in the rare case of two equal hash values, one goes to a comparison of the corresponding cards. It might not really speed up your generation of cards. Given that you want to generate them, it seems likely you will be storing the results for some period of time. Duplicates in a batch of cards can be detected by sorting them.2017-02-11
  • 1
    @AndresMejia yeah, beforehand, because I dont want to have 2+ winners of the same game2017-02-11
  • 0
    @hardmath That's a good idea for non storing the array as it is, just an integer (a seed to construct the array).2017-02-11
  • 0
    @hardmath and it would be also a better way for stablishing conmunications with the server2017-02-11
  • 0
    I think there is much that needs to be cleared up before a mathematically reasoned "answer" can be given. It is possible (without knowledge of the rules for generating cards and for playing the game) that you could have two simultaneous winners even though the cards are different.2017-02-11

0 Answers 0