Esempio n. 1
0
                print(predicted_action)
                if clone.if_attack_move(predicted_action):
                    while game.attack_move_available(
                            game.remove_except_current(predicted_action)):
                        predicted_action, temp_children, temp_moves = tree_search_2.search(
                            game.clone(),
                            chain_move=True,
                            action=predicted_action)
                        temp_policy = get_tree_policy(temp_children,
                                                      temp_moves)
                        store.update_store(
                            [game.clone().state, temp_policy, 0], player2=True)
                        game.play_action(predicted_action)
                        print('P2 Chain -> ', end='\t')
                        print(predicted_action)
            game.flip_perspective()
            step += 1
            if step > 120:
                break
                draw = True
        print(game.state, end="\n")

        # Saving training data
        if not draw:
            if step % 2 == 0:
                store.update_values(player1=1, player2=-1)
            else:
                store.update_values(player1=-1, player2=1)
        else:
            store.update_values(player1=0, player2=0)
        store.save_store('store' + str(iteration))