Exemple #1
0
 def test_winScore_fTest(self):
     game = bingo.Game(self.fTest)
     winStats, loseStats = game.playSequence()
     self.assertEqual(4512, winStats[2])
Exemple #2
0
"""
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))
Exemple #3
0
 def test_winner_fTest(self):
     game = bingo.Game(self.fTest)
     winStats, loseStats = game.playSequence()
     self.assertEqual(2, winStats[0])
Exemple #4
0
 def test_winScore_fInput(self):
     game = bingo.Game(self.fInput)
     winStats, loseStats = game.playSequence()
     self.assertEqual(74320, winStats[2])
Exemple #5
0
 def test_loser_fInput(self):
     game = bingo.Game(self.fInput)
     winStats, loseStats = game.playSequence()
     self.assertEqual(28, loseStats[0])
Exemple #6
0
 def test_winMoveCount_fTest(self):
     game = bingo.Game(self.fTest)
     winStats, loseStats = game.playSequence()
     self.assertEqual(12, winStats[1])
Exemple #7
0
 def test_sequenceMaximum_fTest(self):
     game = bingo.Game(self.fTest)
     self.assertEqual(26, max([int(x) for x in game.sequence]))
Exemple #8
0
 def test_loseMoveCount_fInput(self):
     game = bingo.Game(self.fInput)
     winStats, loseStats = game.playSequence()
     self.assertEqual(88, loseStats[1])
Exemple #9
0
 def test_sequenceMaximum_fInput(self):
     game = bingo.Game(self.fInput)
     self.assertEqual(99, max([int(x) for x in game.sequence]))
Exemple #10
0
 def test_sequenceLength_fTest(self):
     game = bingo.Game(self.fTest)
     self.assertEqual(27, len(game.sequence))
Exemple #11
0
 def test_sequenceLength_fInput(self):
     game = bingo.Game(self.fInput)
     self.assertEqual(100, len(game.sequence))
Exemple #12
0
 def test_cardCount_fTest(self):
     game = bingo.Game(self.fTest)
     self.assertEqual(3, len(game.cards))
Exemple #13
0
 def test_cardCount_fInput(self):
     game = bingo.Game(self.fInput)
     self.assertEqual(100, len(game.cards))