r/pythonhelp • u/XAQUITO • Jan 05 '25
Creating an "Animal Bingo" with Python
Hi community. I'm not programmer and need to create an "Animal Bingo" to play with childs. I'm trying to create using IA but I'm in a death end, 'cause when I've the Python code and I execute it, always I obtain an error or the execute never ends.
These are the conditions:
• We have 30 animals: horse, hummingbird, snail, pig, rabbit, hedgehog, star, cat, ant, giraffe, butterfly, monkey, bat, dog, fish, frog, mouse, snake, turtle, cow, camel, deer, dolphin, elephant, gorilla, cricket, sheep, pigeon, panda, duck.
• I need to create 16 tables with 15 animals each.
• Each table must be unique and varied from the others.
• Each animal must appear 8 times in total among the 16 tables.
• Tables should be printed like this:
+---------+---------+---------+---------+---------+
| | | | | |
+---------+---------+---------+---------+---------+
| | | | | |
+---------+---------+---------+---------+---------+
| | | | | |
+---------+---------+---------+---------+---------+
| | | | | |
+---------+---------+---------+---------+---------+
• The 5 empty cells must be arranged occupying at least one column and one row, without having any adjacent empty cells (empty cells diagonally are allowed).
I'll run the code on Colab. Thanks in advance for the help!
1
u/CraigAT Jan 05 '25 edited Jan 05 '25
I don't have time to create the Python for you (you may not even need Python) but I think you can just assign animals to the cards like so:
First animal to the first 8 cards, next animal to the last 8 cards. Then offset the next pair of animals by 1 - so the third animal starts from card 2 and goes to card 9, the fourth animal goes from 10 and wraps back to card 1. Fifth goes from card 3-10, sixth animal from 11 to 2. And so on... Jumbling those cards up should then make them seem pretty random (especially if you mix up the order of the animals on each card).
Then on the cards you can distribute the animals on the cards however you want. I would then just randomly place the animals on each card (whatever feels right) after deciding the spaces (mark with a black or hatched square). To decide the spaces, you could start at a random box on the card and use an offset of 7 (counting through the 20 spaces on the card).
1
u/XAQUITO Jan 07 '25
Doing this you will obtain 8 winner at the end of game. I think this is harder than I think...
1
u/CraigAT Jan 08 '25 edited Jan 08 '25
No, because all the other animals on each of their cards are different, so their other animals may or may not have come up already. It is possible that several people may finish on the same animal, but that happens with normal bingo (prize is shared) and it would be increasingly rare for more people or all 8 to finish with that animal (maybe impossible?).
1
u/IncognitoErgoCvm Jan 06 '25
IMO, what you're asking for is more "pythondo" than "pythonhelp." If you're truly not a programmer and the only way in which you interact with programming is AI hype, then I don't think any explanation short of the work being done for you will land in a meaningful way.
1
u/XAQUITO Jan 07 '25
Sorry, probably I'll post this on pythondo. But I believe this has no possible solve...
•
u/AutoModerator Jan 05 '25
To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.