Example #1
0
def main_answer_quiz(known_points):
    if point.is_points_duplicated(known_points):
        return False
    computed_points = answer(gen_unknow_points(known_points),
        gen_unshow_numbers(known_points))
    if computed_points and (not point.is_points_duplicated(
        known_points+computed_points)):
        return point.transfer_points_list_to_points_hash(computed_points)
    return False
Example #2
0
				(4,0,0,0,0,0,0,0,0),
				(7,0,9,3,2,0,0,0,5),
				(0,0,1,0,0,7,0,0,0),
				(0,2,0,0,0,0,7,0,0))
	complex_sample = (
				(9,0,0,0,0,0,0,0,5),
				(0,4,0,3,0,0,0,2,0),
				(0,0,8,0,0,0,1,0,0),
				(0,7,0,6,0,3,0,0,0),
				(0,0,0,0,8,0,0,0,0),
				(0,0,0,7,0,9,0,6,0),
				(0,0,1,0,0,0,9,0,0),
				(0,3,0,0,0,6,0,4,0),
				(5,0,0,0,0,0,0,0,8))
	known_points = gen_known_points_from_sample(media_sample)
	unknow_points = gen_unknow_points(known_points)
	unshow_numbers = gen_unshow_numbers(known_points)
	# print "choose_guess_point_values: ", choose_guess_point_values(unknow_points, unshow_numbers)
	computed_all_points = answer(
		unknow_points[:], copy.deepcopy(unshow_numbers))
	print "known_points : %s" % known_points
	print "unknow_points : %s" % unknow_points
	print "len(unknow_points) : %s" % len(unknow_points)
	print "unshow_numbers : %s" % unshow_numbers
	print "is_points_duplicated:",  point.is_points_duplicated(known_points+computed_all_points)
	


	print "computed_all_points : %s " % computed_all_points
	print "len(computed_all_points) : %s " % len(computed_all_points)
	#print "get_intersect_values : %s 5" % get_intersect_values((8,4,7),unshow_numbers)
Example #3
0
                    '6_2': 5, '6_3': 4, '6_4': 7, '6_5': 8, '6_7': 6, 
                    '6_8': 1, '7_0': 1, '7_1': 4, '7_3': 2, '7_4': 9, 
                    '7_5': 5, '7_7': 3, '8_0': 2, '8_1': 8, '8_2': 7, 
                    '8_6': 4 }})


        # answer_quiz_with_indexs_and_digits(number_indexs, digits).must_equal(
        #     {'0_2': 1, '0_6': 9, '0_7': 2, '0_8': 3, '1_1': 7,
        #      '1_3': 5, '1_4': 2, '1_5': 1, '1_7': 8, '1_8': 4,
        #      '2_0': 4, '2_1': 2, '2_3': 9, '2_4': 6, '2_5': 3,
        #      '2_6': 1, '2_7': 7, '2_8': 5, '3_0': 6, '3_2': 3,
        #      '3_3': 7, '3_5': 9, '3_6': 5, '3_8': 2, '4_2': 4,
        #      '4_4': 5, '4_6': 3, '5_0': 8, '5_2': 2, '5_3': 1,
        #      '5_5': 4, '5_6': 7, '5_8': 6, '6_0': 9, '6_1': 3, 
        #      '6_2': 5, '6_3': 4, '6_4': 7, '6_5': 8, '6_7': 6, 
        #      '6_8': 1, '7_0': 1, '7_1': 4, '7_3': 2, '7_4': 9, 
        #      '7_5': 5, '7_7': 3, '8_0': 2, '8_1': 8, '8_2': 7, 
        #      '8_6': 4 })

    with test(choose_guess_point_values):
        choose_guess_point_values(unknow_points, unshow_numbers).must_equal([(0, 6, 2, 3)])

    with test(point.is_points_duplicated):
        computed_all_points = answer(
            unknow_points[:], copy.deepcopy(unshow_numbers))
        point.is_points_duplicated(known_points+computed_all_points).must_false()
        computed_all_points.size().must_equal(57)

    with test(get_intersect_values):
        get_intersect_values((8,4,7),unshow_numbers).must_equal([1, 5, 6, 8])