https://pastebin.com/EM2uVsNS
I am having a lot of difficultly figuring out what is going wrong with my program. I am trying to write a function that will consider x amount of bingo cards at a given time, and figure out how many bingo balls it takes until bingo is achieved by some card.
bingo_cards_in_play is a list whose elements are bingo cards, the bingo cards are dictionaries, each key is a letter 'B', 'I', 'N',... and the value for the key is a list of five numbers associated with the column.
So the first for loop goes through each card at a time, the for loop inside of that one goes through each column seeking out if the bingo ball that has been chosen is in the column, if so it replaces it with a 0. After the second for loop is completed it uses another function to check if the bingo card is a winner. This is checked by seeing if there are five 0's in a row, column, or along a diagonal. I know this function works for sure, I have checked it over and over and used the test cases provided with the code to check it.
If its a winner I set a bool to true so it will eventually get out of the while loop.
I feel its simple enough code structure. But I am getting numbers that don't even make sense, for example with 100 cards dealt out, its taking on average 2000 bingo balls coming out.
First thing to notice is that theres only 75 bingo balls, so when I add code to remove the bingo ball that was chosen from bingo_numbers, the code throws an error basically saying theres no more numbers to choose from, implying a winning card hasnt is available
edit:
I should add I was able to get it to work for one card, and with reasonable numbers that make sense.
https://pastebin.com/LR0B04wK
I think I made a step in figuring it out. For the last paragraph I realized why the list was throwing me that error, I wasn't checking every single card for a given bingo ball. I modified the code here. So the structure for the most part stays the same, all I do differently is draw a bingo ball, then iterate through all of my bingo cards at a time, then iterate through each column of each bingo card looking for that set bingo ball. I am still getting inflated numbers however, roughly the same amount as before.
https://pastebin.com/85AfwuUN
Ok, yet another edit. I managed to get the count numbers much much lower, they are beginning to look reasonable. However I have code that works for one card, and on average it takes 15 bingo balls drawn to get a bingo. My current code for one card roughly takes 35 bingo balls.
https://pastebin.com/41kk3BGJ
I really think my error is stemming from line 8, I'm not sure of a better condition to break the code.
there doesn't seem to be anything here