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