Esempio n. 1
0
    def get_game_history(self, face_state):
        result_step = -1
        win_times = 0
        lose_times = 0
        my_long_memory = MyDjMemory()
        my_memory_result = my_long_memory.search_by_face_state(face_state)
        if len(my_memory_result) == 0:
            result_step = self.random_step(face_state)
        else:
            for item in my_memory_result:
                if self.win_percent_compare(win_times, lose_times, item[3], item[4]) and self.win_percent(item[3], item[4]) > 0.1:
                    result_step = item[2]
                    win_times = item[3]
                    lose_times = item[4]
                else:
                    result_step = self.random_step(face_state)

        return result_step, win_times, lose_times
Esempio n. 2
0
# Created by Traburiss on 2016/3/16
from Tools.my_dj_memory import MyDjMemory

db = MyDjMemory()
db.insert("101100010", 2, 122, 231)
# value = db.search()
value = db.search_by_face_state("101100010")
print(len(value))
for item in value:
    print(item)