Ccmmutty logo
Commutty IT
5 min read

【Python】艦これ自動化したら建造しなくてもいける説

https://cdn.magicode.io/media/notebox/93d6c1eb-85d5-4923-9361-4baac850f067.jpeg

0. はじめに

前提条件を下記に示します.

0.1. 使用コアプログラム

下記のプログラムをベースにやっていきます.

0.2. チュートリアルの建造はノーカウント

ただし,All 30の建造にしました.

0.3. クエスト報酬の艦娘もなし

これは状況によっては変更する可能性があります.
相当シビアな状況だと解禁する可能性があります.

0.4. 武器の生成もなし

武器の生成もなしでいこうと思っています.
上記の条件の元やっていきます.

1. 1日目~ベースプログラムの構築~

1.1. プログラム

艦これゲームのテンプレートを収集しつつ動作させていきます.
下記プログラムはプログラムの一部抜粋です.
def main_Parallel(self):
        
        
        # param_dict = {}
        # param_dict["wait_sec"]        = 20*60
        # param_dict["SUPPLY_FLAG"]     = True
        # param_dict["Bulk_FLAG"]       = True
        # param_dict["Home_FLAG"]       = True
        with open('param_dict.json') as f:
            param_dict = json.load(f)

        while 1:
            
            # --------------------------------------------
            # param save
            #
            with open('param_dict.json', 'w') as f:
                json.dump(param_dict, f, indent=4)
                
            with open('param_dict.json') as f:
                param_dict = json.load(f)
    
    
    
            detect_total_df = A2P.tap_temp_image5_Parallel()
            
            print(detect_total_df)
            print("-----")
            detect_total_df2 = detect_total_df[detect_total_df["maxVal"] > self.search_th]
            print(detect_total_df2)

            if(len(detect_total_df2)==1):
                temp_key = detect_total_df2["x"][0]

                print(">>>>>> {}".format(temp_key))
                self._tap_PC2Android(detect_total_df2["x"][0], detect_total_df2["y"][0])

1.2. 課題

今までのプログラムと比べて相当厄介なつくりになりそうです.
その理由として,「補給」があります.
一度,ホーム画面に戻って「補給」処理がきちんと行われた場合に「出撃」を行うという処理が結構厄介です.
なんとかこの辺をクリアして自動で補給をするような仕組みにしたいです.

1.3. 成果

なんとか演習を駆使してレベルを上げてから,1-1をループして6隻編成できるまでにしました.
明日からも1-1ループでレベリングしていきます.

2. 2日目~演習/出撃プログラムの修正~

2.1. 演習プログラムの修正

テンプレートをさらに追加!
しかし,まだうまく検知できない部分があるので,今後修正が必要!
if(self._key_tap("Exercise_no_try1", detect_total_df2, time_sleep=2) ): 
        param_dict["SUPPLY_FLAG"] = False
        continue
    if(self._key_tap("Exercise_no_try2", detect_total_df2, time_sleep=2) ): 
        param_dict["SUPPLY_FLAG"] = False
        continue
    if(self._key_tap("Exercise_no_try3", detect_total_df2, time_sleep=2) ): 
        param_dict["SUPPLY_FLAG"] = False
        continue
    if(self._key_tap("Exercise_no_try4", detect_total_df2, time_sleep=2) ): 
        param_dict["SUPPLY_FLAG"] = False
        continue
    
    if(self._key_tap("Exercise_no_try5", detect_total_df2, time_sleep=2) ): 
        param_dict["SUPPLY_FLAG"] = False
        continue

2.2. 出撃プログラムの修正

1-1は最深部まで攻略するように修正.
しかし,これが悲劇の始まりだった
if(self._key_tap("next_stage", detect_total_df2)): continue

2.3. 成果

1-1はまだ早すぎたようだ. なんと,3人轟沈してしまう悲劇に!
1-1の最初の1戦だけトライして退却するようにしないといけないかもしれない...

3. 2日目~演習/出撃プログラムの修正~

==== 執筆中 ====

Discussion

コメントにはログインが必要です。