def test_soldier_sift(self): threshold = unit_constants.cherrystone_soldier_sift_threshold for frame in range(self.frame_count): wargroove_ctrl.vision.load_frame(self.__get_eval_folder() + str(frame) + '.png') match = wargroove_ctrl.find_unit_with_sift('cherrystone_soldier', threshold=threshold) wargroove_ctrl.log_match_for_evaluation(self.id(), match, threshold) assert_that(match).described_as('match in frame ' + str(frame)).is_not_none() assert_that(match.location[0]).described_as('match x value in frame ' + str(frame)).is_between(500, 536) assert_that(match.location[1]).described_as('match y value in frame ' + str(frame)).is_between(218, 272)
def test_villager_sift(self): threshold = unit_constants.cherrystone_villager_sift_threshold incorrect_location_count = 0 for frame in range(self.frame_count): wargroove_ctrl.vision.load_frame(self.__get_eval_folder() + str(frame) + '.png') match = wargroove_ctrl.find_unit_with_sift('cherrystone_villager', threshold=threshold) wargroove_ctrl.log_match_for_evaluation(self.id(), match, threshold) if match is not None: if match.location[0] < 506 or match.location[ 0] > 536 or match.location[1] < 124 or match.location[ 1] > 176: incorrect_location_count = incorrect_location_count + 1 assert_that(incorrect_location_count).is_equal_to(0)
def test_stronghold_sift(self): threshold = unit_constants.cherrystone_stronghold_sift_threshold incorrect_location_count = 0 for frame in range(self.frame_count): wargroove_ctrl.vision.load_frame(self.__get_eval_folder() + str(frame) + '.png') match = wargroove_ctrl.find_building_with_sift( 'cherrystone_stronghold', threshold=threshold) wargroove_ctrl.log_match_for_evaluation(self.id(), match, threshold) if match is not None: if match.location[0] < 446 or match.location[ 0] > 496 or match.location[1] < 402 or match.location[ 1] > 482: incorrect_location_count = incorrect_location_count + 1 assert_that(incorrect_location_count).is_equal_to(0)