Ejemplo n.º 1
0
 def test_double(self):
     self.assertEqual(
         main(data=['3D 5S 2H QD TD 6S KH 9H AD QH'], silent=True),
         [[['3D', '5S', '2H', 'QD', 'TD'], ['6S', 'KH', '9H', 'AD', 'QH'],
           'highest card']])
Ejemplo n.º 2
0
 def test_double(self):
     self.assertEqual(
         main(data=['6C 9C 8C 2D 7C 2H TC 4C 9S AH'],
              silent=True), [[['6C', '9C', '8C', '2D', '7C'],
                              ['2H', 'TC', '4C', '9S', 'AH'], 'one-pair']])
Ejemplo n.º 3
0
 def test_straight_flush(self):
     self.assertEqual(
         main(data=['TH JH QC QD QS QH KH AH 2S 6S'], silent=True),
         [[['TH', 'JH', 'QC', 'QD', 'QS'], ['QH', 'KH', 'AH', '2S', '6S'],
           'straight-flush']])
Ejemplo n.º 4
0
 def test_triple(self):
     self.assertEqual(
         main(data=['KS AH 2H 3C 4H KC 2C TC 2D AS'], silent=True),
         [[['KS', 'AH', '2H', '3C', '4H'], ['KC', '2C', 'TC', '2D', 'AS'],
           'three-of-a-kind']])
Ejemplo n.º 5
0
 def test_double(self):
     self.assertEqual(
         main(data=['AH 2C 9S AD 3C QH KS JS JD KD'],
              silent=True), [[['AH', '2C', '9S', 'AD', '3C'],
                              ['QH', 'KS', 'JS', 'JD', 'KD'], 'two-pair']])
Ejemplo n.º 6
0
 def test_straight(self):
     self.assertEqual(
         main(data=['AC 2D 9C 3S KD 5S 4D KS AS 4C'],
              silent=True), [[['AC', '2D', '9C', '3S', 'KD'],
                              ['5S', '4D', 'KS', 'AS', '4C'], 'straight']])
Ejemplo n.º 7
0
 def test_flush(self):
     self.assertEqual(
         main(data=['2H AD 5H AC 7H AH 6H 9H 4H 3C'],
              silent=True), [[['2H', 'AD', '5H', 'AC', '7H'],
                              ['AH', '6H', '9H', '4H', '3C'], 'flush']])
Ejemplo n.º 8
0
 def test_full_house(self):
     self.assertEqual(
         main(data=['2H 2S 3H 3S 3C 2D 9C 3D 6C TH'], silent=True),
         [[['2H', '2S', '3H', '3S', '3C'], ['2D', '9C', '3D', '6C', 'TH'],
           'full-house']])
Ejemplo n.º 9
0
 def test_four(self):
     self.assertEqual(
         main(data=['2H 2S 3H 3S 3C 2D 3D 6C 9C TH'], silent=True),
         [[['2H', '2S', '3H', '3S', '3C'], ['2D', '3D', '6C', '9C', 'TH'],
           'four-of-a-kind']])
Ejemplo n.º 10
0
    args = parser.parse_args()
    if args.name:
        if args.name.isalnum() and not args.number_of_w:
            args.number_of_w = int(args.name)
            args.name = None
    if args.VOCAL:
        vocal = True
    if not args.name:
        print(
            'Default case, Input: \'deck.input\', Output: \'[timestamp]_[pid].output\''
        )
        nm = 'deck.input'  # default
    else:
        print(f'Input \'{args.name}\', Output: \'[timestamp]_[pid].output\'')
        nm = args.name.strip('\"\'')
    if not path.exists(nm):
        raise FileNotFoundError
    if not args.MULTPROC:
        print('Using 1 logical core')
        main(name_of_file=nm, data=False, show_best_hand=vocal)
    else:
        if not args.number_of_w:
            print('Default case for mp, numbers of workers: 4')
            print('output file will be split into chunks')
            nw = 4
        else:
            print(f'Number of workers: {args.number_of_w}')
            print('output file will be split into chunks')
            nw = args.number_of_w
        mp_realization(name_of_file=nm, number_of_w=nw)