On the other hand, it might be wise to try a different strategy: let the giant squid win.

You aren’t sure how many bingo boards a giant squid could play at once, so rather than waste time counting its arms, the safe thing to do is to figure out which board will win last and choose that one. That way, no matter which boards it picks, it will win for sure.

In the above example, the second board is the last to win, which happens after 13 is eventually called and its middle column is completely marked. If you were to keep playing until this point, the second board would have a sum of unmarked numbers equal to 148 for a final score of \(148 \times 13 = 1924\).

Assignment

Figure out which board will win last. Once it wins, what would its final score be? Determine this in the following way:

Example

In this interactive session we assume the text files boards01.txt1 and boards02.txt2 to be located in the current directory.

> score("boards01.txt")
1924
> score("boards02.txt")
9576

Epilogue

Jari Komppa (@Sol_HSA3) animated his solution.