def gen_known_points_from_sample(sample): # def append_point(result,cur_point): # row_index, col_index = cur_point # value = sample[row_index][col_index] # if value > 0: # result.append(point.gen_point(row_index,col_index,value)) # return result # return reduce(append_point, gen_99(), []) return [point.gen_point(row_index,col_index,sample[row_index][col_index]) for row_index, col_index in gen_99() if sample[row_index][col_index] > 0]
def append_number(result, cur_point): map(lambda name, index: result.update({(name, index):range(1,10)}), point.NAMES, point.gen_point(cur_point)) return result
def append_point(result,cur_point): row_index, col_index = cur_point value = sample[row_index][col_index] if value > 0: result.append(point.gen_point(row_index,col_index,value)) return result