コード例 #1
0
    def test_aceBig2Memory(self):
        cards = self.__createCards(1,22, 3,22, 3,21)
        aceBig2Memory = SimpleFelix.AceBig2Memory(cards)

        self.assertFalse(aceBig2Memory.isMustWin(Hand([Card(3,21)])))
        self.assertFalse(aceBig2Memory.isMustWin(Hand([Card(1,22)])))
        self.assertFalse(aceBig2Memory.isMustWin(Hand([Card(3,22)])))

        aceBig2Memory.remember(Hand([Card(4,22)]))

        self.assertFalse(aceBig2Memory.isMustWin(Hand([Card(3,21)])))
        self.assertFalse(aceBig2Memory.isMustWin(Hand([Card(1,22)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(3,22)])))

        aceBig2Memory.remember(Hand([Card(2,22)]))

        self.assertFalse(aceBig2Memory.isMustWin(Hand([Card(3,21)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(1,22)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(3,22)])))

        aceBig2Memory.remember(Hand([Card(1,21)]))

        self.assertFalse(aceBig2Memory.isMustWin(Hand([Card(3,21)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(1,22)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(3,22)])))

        aceBig2Memory.remember(Hand([Card(4,21)]))

        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(3,21)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(1,22)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(3,22)])))
コード例 #2
0
    def test_aceBig2MemoryWithAllAceBig2(self):
        cards = self.__createCards(1,22, 3,22, 4,22, 2,22, 1,21, 3,21, 4,21, 2,21)
        aceBig2Memory = SimpleFelix.AceBig2Memory(cards)

        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(1,21)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(2,21)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(3,21)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(4,21)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(1,22)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(2,22)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(3,22)])))
        self.assertTrue(aceBig2Memory.isMustWin(Hand([Card(4,22)])))