def HvsC(human, computer, Clever_Stupid): # logger = logging.getLogger() # handler=logging.FileHandler("Log_game_2.txt") # logger.addHandler(handler) # logger.setLevel(logging.NOTSET) d = 5 input_n = len(human) computer.reverse() currentList = computer + human if Clever_Stupid == 'A' else human + computer dict = computer_next_step(currentList, input_n, d, Clever_Stupid) next_list = dict['list'] selected_index = len(next_list) / 2 - 1 - dict['index'] # logger.debug("in algorithm current_list : %s",str(next_list)) # logger.debug("in algorithm selected_index : %s",str(selected_index)) computer = next_list[0:len(next_list) / 2] human = next_list[len(next_list) / 2:len(next_list)] if Clever_Stupid == 'B': human, computer = computer, human computer.reverse() return [human, computer, selected_index]
def HvsC(human, computer, Clever_Stupid): # logger = logging.getLogger() # handler=logging.FileHandler("Log_game_2.txt") # logger.addHandler(handler) # logger.setLevel(logging.NOTSET) d = 5 input_n = len(human) computer.reverse() currentList = computer + human if Clever_Stupid == 'A' else human + computer dict = computer_next_step(currentList,input_n,d,Clever_Stupid) next_list = dict['list'] selected_index = len(next_list)/2 - 1 - dict['index'] # logger.debug("in algorithm current_list : %s",str(next_list)) # logger.debug("in algorithm selected_index : %s",str(selected_index)) computer = next_list[0:len(next_list) / 2] human = next_list[len(next_list) / 2 : len(next_list)] if Clever_Stupid == 'B': human, computer = computer, human computer.reverse() return [human, computer, selected_index]
def CvsC(computer_A, computer_B, Clever_Stupid, who_s_turn): d = 4 # who_s_turn = 'A' dict = computer_next_step(computer_A, computer_B, d, Clever_Stupid, who_s_turn) next_list = dict['list'] if who_s_turn=='B': selected_index = len(next_list) - 1 - dict['index'] else: selected_index = dict['index'] computer_A = next_list[0:len(next_list) / 2] computer_B = next_list[len(next_list) / 2 : len(next_list)] computer_B.reverse() return { "computer_B": computer_B, "computer_A": computer_A, "selected_index": selected_index }
def HvsC(human, computer, Clever_Stupid): d = 3 who_s_turn = 'A' dict = computer_next_step(computer, human, d, Clever_Stupid, who_s_turn) next_list = dict['list'] if who_s_turn=='B': selected_index = len(next_list) - 1 - dict['index'] else: selected_index = dict['index'] computer = next_list[0:len(next_list) / 2] human = next_list[len(next_list) / 2 : len(next_list)] human.reverse() return { "human": human, "computer": computer, "selected_index": selected_index }
def HvsC(human, computer, Clever_Stupid): d = 3 who_s_turn = 'A' dict = computer_next_step(computer, human, d, Clever_Stupid, who_s_turn) next_list = dict['list'] if who_s_turn == 'B': selected_index = len(next_list) - 1 - dict['index'] else: selected_index = dict['index'] computer = next_list[0:len(next_list) / 2] human = next_list[len(next_list) / 2:len(next_list)] human.reverse() return { "human": human, "computer": computer, "selected_index": selected_index }
def CvsC(computer_A, computer_B, Clever_Stupid, who_s_turn): d = 4 # who_s_turn = 'A' dict = computer_next_step(computer_A, computer_B, d, Clever_Stupid, who_s_turn) next_list = dict['list'] if who_s_turn == 'B': selected_index = len(next_list) - 1 - dict['index'] else: selected_index = dict['index'] computer_A = next_list[0:len(next_list) / 2] computer_B = next_list[len(next_list) / 2:len(next_list)] computer_B.reverse() return { "computer_B": computer_B, "computer_A": computer_A, "selected_index": selected_index }