def Q_R(player): Q1 = Qlearn(player) s = simpleSequence() s.printTitle("Q Learning vs Random") s.print_board() s.printHand() while not s.complete(): while True: if player == s.player: state = str(s.board_string()) + '-' + s.getHand(player) #print(state) card, location = Q1.play(state) if not s.make_move(card, location): print("Invalid Move!! Try Again!!") else: break else: #state = s.board_string() + '-' + s.getHand(player2) #print(state) card = random.choice(s.available_moves()) #print(card.suit) while (card.value == 'Jack'): card = random.choice(s.available_moves()) location = s.find_card_location(card) if not s.make_move(card, location): print("Invalid Move!! Try Again!!") else: break s.printHand() s.switch_player()
def Q_M(player, player2): Q1 = Qlearn(player) M2 = miniMAX(player2) s = simpleSequence() time.sleep(10) s.printTitle("Minimax Q vs Q Learning") s.print_board() s.printHand() while not s.complete(): while True: if player == s.player: state = str(s.board_string()) + '-' + s.getHand(player) #print(state) card, location = Q1.play(state) if not s.make_move(card, location): print("Invalid Move!! Try Again!!") else: break else: state = s.board_string() + '-' + s.getHand(player2) #print(state) card, location = M2.play(state) if not s.make_move(card, location): print("Invalid Move!! Try Again!!") else: break s.printHand() s.switch_player()