Ejemplo n.º 1
0
    def test_Play_CoinFlipsTails_StartsNewCard(self):
        homer = Player("Homer")
        game = Create.game() \
            .with_inbox_column([Card()]) \
            .please()

        homer.play(game, COIN_TAILS)

        self.assertEqual(game.column("Development").Cards, [Card("Homer")])
Ejemplo n.º 2
0
    def test_Play_CoinFlipsTails_HasAssignedBlockedCardInTesting_UnblocksTheCard(
            self):
        homer = Player("Homer")
        game = Create \
            .game() \
            .with_testing_column([Card("Homer", True)]) \
            .please()

        homer.play(game, COIN_TAILS)

        self.assertEqual(game.column("Testing").Cards, [Card("Homer", False)])
Ejemplo n.º 3
0
    def test_Play_CoinFlipsTails_HasAssignedCardInTesting_MovesTheCardToDone(
            self):
        homer = Player("Homer")
        game = Create.game() \
            .with_testing_column([Card("Homer")]) \
            .please()

        homer.play(game, COIN_TAILS)

        self.assertEqual(game.column("Testing").Cards, [])
        self.assertEqual(game.column("Done").Cards, [Card("Homer")])
Ejemplo n.º 4
0
    def test_PlayWithWipLimits_CoinFlipsHeads_BlockAndRespectWipLimit(self):
        homer = Player("Homer")
        game = Create.game() \
            .with_inbox_column([Card()]) \
            .with_development_column(cards=[Card("Homer", False)], wip_limit=1) \
            .with_testing_column(cards=[Card("Homer", True)], wip_limit=1) \
            .please()

        homer.play(game, COIN_HEADS)

        self.assertEqual(
            game.column("Development").Cards, [Card("Homer", True)])
        self.assertEqual(game.column("Testing").Cards, [Card("Homer", True)])
Ejemplo n.º 5
0
    def test_Play_CoinFlipsHeads_HasCardInDevelopment_BlocksTheCardAndStartsNewCard(
            self):
        homer = Player("Homer")
        game = Create \
            .game() \
            .with_inbox_column([Card()]) \
            .with_development_column([Card("Homer", False)]) \
            .please()

        homer.play(game, COIN_HEADS)

        self.assertEqual(
            game.column("Development").Cards,
            [Card("Homer", True), Card("Homer", False)])
Ejemplo n.º 6
0
    def test_PlayWithWipLimits_CoinFlipsTails_HelpOthersWithDevelopmentIfCanNotWorkOnMyCards(
            self):
        homer = Player("Homer")
        game = Create.game() \
            .with_inbox_column([Card()]) \
            .with_development_column(cards=[Card("Marge")], wip_limit=1) \
            .with_testing_column(cards=[], wip_limit=1) \
            .please()

        homer.play(game, COIN_TAILS)

        self.assertEqual(game.column("Development").Cards, [])
        self.assertEqual(game.column("Testing").Cards, [Card("Marge")])
        self.assertEqual(game.column("Done").Cards, [])
Ejemplo n.º 7
0
    def test_Play():
        homer = Player("Homer")
        marge = Player("Marge")
        bart = Player("Bart")
        liza = Player("Liza")
        maggie = Player("Maggie")
        coin = Coin()
        done_cards = []

        for game_count in range(1000):
            inbox = []
            for card_count in range(20):
                inbox.append(Card())
            game = Create.game() \
                .with_inbox_column(inbox) \
                .with_development_column([], 7) \
                .with_testing_column([], 7) \
                .please()

            for steps_count in range(20):
                homer.play(game, coin)
                marge.play(game, coin)
                bart.play(game, coin)
                liza.play(game, coin)
                maggie.play(game, coin)

            done_cards.append(len(game.column("Done").Cards))

        print(done_cards)
        print(np.mean(done_cards))
Ejemplo n.º 8
0
    def test_CanAssignCard(self):
        c = Card()
        player = Player("Homer")

        c.assign_to(player)

        self.assertEqual(c.AssignedTo, "Homer")
Ejemplo n.º 9
0
    def test_CanUnlockCard(self):
        c = Card()
        c.lock()

        c.unlock()

        self.assertFalse(c.IsLocked)
Ejemplo n.º 10
0
    def test_CanPushCardsIndependently(self):
        column1 = Column()
        column2 = Column()

        column1.push(Card())

        self.assertEqual(len(column1.Cards), 1)
        self.assertEqual(len(column2.Cards), 0)
Ejemplo n.º 11
0
    def test_CanNotPullBlockedCard(self):
        column1 = Column()
        card = Card()
        card.lock()
        column1.push(card)
        column2 = Column()

        column2.pull_from(column1)

        self.assertEqual(len(column1.Cards), 1)
        self.assertEqual(len(column2.Cards), 0)
Ejemplo n.º 12
0
 def test_ByDefault_IsNotBlocked(self):
     c = Card()
     self.assertFalse(c.IsLocked)
Ejemplo n.º 13
0
 def test_CanLockCard(self):
     c = Card()
     c.lock()
     self.assertTrue(c.IsLocked)
Ejemplo n.º 14
0
 def __init__(self, number_of_cards=0, wip_limit=0):
     self._wip_limit = wip_limit
     self.Cards = []
     for i in range(number_of_cards):
         self.Cards.append(Card())