def test_winScore_fTest(self): game = bingo.Game(self.fTest) winStats, loseStats = game.playSequence() self.assertEqual(4512, winStats[2])
""" https://adventofcode.com/2021/day/4 """ from bingo import bingo # import logging # import sys if __name__ == '__main__': # logging.basicConfig(filename="../log/2021_d04.log", encoding='utf-8', level=logging.WARNING) fInput = "input2021_04a.txt" game = bingo.Game(fInput) win, lose = game.playSequence() print("Winner: card {} in {} moves with a final score of {}.".format(*win)) print("Loser: card {} in {} moves with a final score of {}.".format(*lose))
def test_winner_fTest(self): game = bingo.Game(self.fTest) winStats, loseStats = game.playSequence() self.assertEqual(2, winStats[0])
def test_winScore_fInput(self): game = bingo.Game(self.fInput) winStats, loseStats = game.playSequence() self.assertEqual(74320, winStats[2])
def test_loser_fInput(self): game = bingo.Game(self.fInput) winStats, loseStats = game.playSequence() self.assertEqual(28, loseStats[0])
def test_winMoveCount_fTest(self): game = bingo.Game(self.fTest) winStats, loseStats = game.playSequence() self.assertEqual(12, winStats[1])
def test_sequenceMaximum_fTest(self): game = bingo.Game(self.fTest) self.assertEqual(26, max([int(x) for x in game.sequence]))
def test_loseMoveCount_fInput(self): game = bingo.Game(self.fInput) winStats, loseStats = game.playSequence() self.assertEqual(88, loseStats[1])
def test_sequenceMaximum_fInput(self): game = bingo.Game(self.fInput) self.assertEqual(99, max([int(x) for x in game.sequence]))
def test_sequenceLength_fTest(self): game = bingo.Game(self.fTest) self.assertEqual(27, len(game.sequence))
def test_sequenceLength_fInput(self): game = bingo.Game(self.fInput) self.assertEqual(100, len(game.sequence))
def test_cardCount_fTest(self): game = bingo.Game(self.fTest) self.assertEqual(3, len(game.cards))
def test_cardCount_fInput(self): game = bingo.Game(self.fInput) self.assertEqual(100, len(game.cards))