示例#1
0
    def test_to_from_list(self):
        """Tests building lists of cards from a theaigame hand / table token"""
        b = CardBuilder()

        self.assertFalse(b.from_list('asdf2njks92'))

        cases = [([Card(10, C.HEARTS), Card(3, C.DIAMONDS)], '[Th,3d]'),
                 ([Card(3, C.DIAMONDS), Card(10, C.HEARTS)], '[3d,Th]'),
                 ([Card(10, C.CLUBS), Card(8, C.DIAMONDS), Card(9, C.CLUBS)],
                  '[Tc,8d,9c]')]

        for case in cases:
            us, aig_str = case
            self.assertEqual(us, b.from_list(aig_str))
            self.assertEqual(aig_str, cards.to_aigames_list(us))
示例#2
0
    def test_to_from_list(self):
        """Tests building lists of cards from a theaigame hand / table token"""
        b = CardBuilder()

        self.assertFalse(b.from_list('asdf2njks92'))

        cases = [([Card(10, C.HEARTS), Card(3, C.DIAMONDS)], '[Th,3d]'),
                 ([Card(3, C.DIAMONDS),
                   Card(10, C.HEARTS)], '[3d,Th]'),
                 ([Card(10, C.CLUBS),
                   Card(8, C.DIAMONDS),
                   Card(9, C.CLUBS)], '[Tc,8d,9c]')]

        for case in cases:
            us, aig_str = case
            self.assertEqual(us, b.from_list(aig_str))
            self.assertEqual(aig_str, cards.to_aigames_list(us))
示例#3
0
文件: arena.py 项目: gnmerritt/poker
 def say_table_cards(self, dealt_cards):
     """Tells the bots about table cards"""
     table_list = \
         'Match table {}'.format(cards.to_aigames_list(dealt_cards))
     self.tell_bots([table_list])
示例#4
0
文件: arena.py 项目: gnmerritt/poker
 def say_hands(self, bot_hands):
     for bot, hand in bot_hands.iteritems():
         hand_string = cards.to_aigames_list(hand)
         hand_line = '{b} hand {h}'.format(b=bot, h=hand_string)
         self.tell_bot(bot, [hand_line])
示例#5
0
文件: arena.py 项目: noke8868/poker
 def say_table_cards(self, dealt_cards):
     """Tells the bots about table cards"""
     table_list = \
         'Match table {}'.format(cards.to_aigames_list(dealt_cards))
     self.tell_bots([table_list])
示例#6
0
文件: arena.py 项目: noke8868/poker
 def say_hands(self, bot_hands):
     for bot, hand in bot_hands.iteritems():
         hand_string = cards.to_aigames_list(hand)
         hand_line = '{b} hand {h}'.format(b=bot, h=hand_string)
         self.tell_bot(bot, [hand_line])