Sager Bingo!


In [ ]:
import sagerbingo
sagerbingo.setup()

Get Data

Here we read in an example of bingo lines (you can feed the board object any of list of phrases.


In [ ]:
with open('bingo.csv') as f:
    bingo_squares = f.read().splitlines()

And we instantiate a board. Note at this point we can either access the board (it has been shuffled once) or shuffle a few more times for good measure. I'll show how to do both


In [ ]:
game1 = sagerbingo.Board(bingo_squares)
sagerbingo.shuffle()

Here we are accessing the baord once:


In [ ]:
game1.board

And now we shuffle it again (repeat this cell as many times as you like.


In [ ]:
game1.shuffle()

Analyze Data

What happens when a Sager-ism occurs? Do we have to copy and paste this dataframe (shudders) or even .to_csv? Hell no! We have a method to cross off any square in the board. Conviently it's the .X method. You'll need to pass it in a letter column ("S","A","G","E","R" for now- larger boards coming later), and a row number (0,1,2,3,4- becuase fuck 1 index langauges).


In [ ]:
game1.X('R',4)

In [ ]:
game1.X('S',1)

As you can see Column R Row 4, and Column S, row 1 now has strikethrough text rather than regular text. So you know you crossed it out!


In [ ]:
game1.X('A',4)

Ooooopps- what happens if you accidentally crossed out something that didn't actually happen? Shit- that pause wasn't akward enough. Turns out Suraj was just stretching and not asking a question. What are you going to do?? Luckily there is a handily named "un_X" function that takes in the cell you want to un-cross out and returns the board without the strike through!


In [ ]:
game1.un_X('A',4)

Get Results

Somehow work "Bingo" into an audible level in the classroom. You can pull the Alexandria and pretend to pay attenion, ask a question you know the answer to and reply with "bingo" or you could be a dick and yell it out. Don't be a dick- make it fun.

Coming soon- an automated "Bingo" that tells you when you've got a certain style of game bingo!


In [ ]:
sagerbingo.final()