Example #1
0
 def test_shuffle(self):
     '''
     test method shuffle()
     '''
     shoe = Shoe(8)
     self.assertEqual("Ac", str(shoe.deal()), "no shuffle Ace clubs first")
     shoe.reset()
     expected_clubs = "Ac2c3c4c5c6c7c8c9cTcJcQcKc"
     cards = ""
     for _ in range(13):
         cards += str(shoe.deal())
     self.assertEqual(expected_clubs, cards, "pre-shuffle")
     shoe.shuffle()
     cards = ""
     for _ in range(13):
         cards += str(shoe.deal())
     self.assertNotEqual(expected_clubs, cards, "post-shuffle")
Example #2
0
 def __init__(self, shoe=None, player=None, banker=None, system=None):
     '''!
     TBD
     '''
     #
     if shoe is None:
         shoe = Shoe(8)
         shoe.shuffle()
     if player is None:
         player = Hand()
     if banker is None:
         banker = Hand()
     #
     self.__shoe = shoe
     self.__player = player
     ##!< banker is the Hand for banker
     self.__banker = banker
     ##!< system_play is the bacc system we are tracking
     self.system_play = system
     #
     self.count_d7 = 0
     self.count_p8 = 0
def just_boards():
    print("*** JustBoards ***")
    shoe = Shoe(8)
    shoe.shuffle()
    Game(shoe=shoe, system=JustBoards()).play()
        help="instead of playing just create and save a random shoe")
    parser.add_argument("--use", dest="use_filespec",
        help="use a saved shoe instead of random generation")
    parser.add_argument("--just_boards", type=str2bool, nargs='?', const=True,
        default=False,
        help="Just use the program to display board results")
    args = parser.parse_args()

    if args.use_filespec is not None:
        if args.create_filespec is not None:
            raise ValueError("can not use both --create and --use at same time")
        # --use creates an empty shoe, then fill from a saved file
        shoe = Shoe(0)
        shoe.load_shoe(args.use_filespec)
        play(shoe)
    else:
        # generate a new random shoe
        if args.create_filespec is not None:
            shoe = Shoe(8)
            shoe.shuffle()
            # --create saves the new shoe and exists
            shoe.save_shoe(args.create_filespec)
            shoe = None
        else:
            if args.just_boards:
                just_boards()
            else:
                play()

# END #