<commit_before><commit_msg>added a play to debug the window evaluator.  #62<commit_after>import play
import behavior
import main
import robocup
import evaluation
import constants


# This isn't a real play, but it's pretty useful
# Turn it on and we'll draw the window evaluator stuff on-screen from the ball to our goal
class DebugWindowEvaluator(play.Play):

    def __init__(self):
        super().__init__(continuous=True)

        self.add_transition(behavior.Behavior.State.start,
            behavior.Behavior.State.running,
            lambda: True,
            'immediately')


    def execute_running(self):
        pt = main.ball().pos
        seg = constants.Field.OurGoalSegment

        win_eval = evaluation.window_evaluator.WindowEvaluator()
        windows, best = win_eval.eval_pt_to_seg(pt, seg)

        main.system_state().draw_circle(pt, 0.03, constants.Colors.Blue, "DebugWindows")
        main.system_state().draw_line(seg, constants.Colors.Blue, "DebugWindows")
        if best != None:
            main.system_state().draw_line(best.segment, constants.Colors.Green, "DebugWindows")
            main.system_state().draw_line(robocup.Line(pt, best.segment.center()), constants.Colors.Green, "DebugWindows")
{'fraction_non_alphanumeric': 0.10325203252032521, 'fraction_numerical': 0.0040650406504065045, 'mean_word_length': 3.3964285714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3016012', 'n_tokens_mistral': 361, 'n_tokens_neox': 349, 'n_words': 85}