<commit_before>class RobotRuntimeException(BaseException):
    """
    Generic runtime exception for game interpreter
    """

class RobotAlgorithm:
    def __init__(self, robot, raw_program):
        self.robot = robot
        
        commands = self.__to_commands_list(raw_program)
        stack = self.__to_stack(commands)
        
        self.program = self.__translate(stack)        
        self.current_step = 0
        
    def run_next_command(self):
        if self.current_step >= len(self.program):
            self.current_step = 0   
    
        statement = self.program[self.current_step]
        cmd = statement[0]
        arg = statement[1] if len(statement) > 1 else ''     
        skip = statement[2] if len(statement) > 2 else 0
        
        while cmd == 'if':
            self.current_step += 1
            
            passed = self.__evaluate(arg)
            if passed == False:
                self.current_step += skip
                
            if self.current_step >= len(self.program):
                cmd = None
                break
                
            statement = self.program[self.current_step]
            cmd = statement[0]
            arg = statement[1] if len(statement) > 1 else ''     
            skip = int(statement[2]) if len(statement) > 2 else 0
            
        if cmd == 'rl':
            self.robot.rotate(-90)
        elif cmd == 'rr':
            self.robot.rotate(90)
        elif cmd == 'fd':
            self.robot.move_forward()
        elif cmd =='sh':
            self.robot.shoot(15)
        else:
            raise RobotRuntimeException('Unknown command - {}'.format(cmd))
            
        self.current_step += 1
            
    def __evaluate(self, condition):<commit_msg>Add bad command exception; remove unnecessary cast<commit_after>class RobotRuntimeException(BaseException):
    """
    Generic runtime exception for game interpreter
    """

class RobotAlgorithm:
    def __init__(self, robot, raw_program):
        self.robot = robot
        
        commands = self.__to_commands_list(raw_program)
        stack = self.__to_stack(commands)
        
        self.program = self.__translate(stack)        
        self.current_step = 0
        
    def run_next_command(self):
        if self.current_step >= len(self.program):
            self.current_step = 0   
    
        statement = self.program[self.current_step]
        cmd = statement[0]
        arg = statement[1] if len(statement) > 1 else ''     
        skip = statement[2] if len(statement) > 2 else 0
        
        while cmd == 'if':
            self.current_step += 1
            
            passed = self.__evaluate(arg)
            if passed == False:
                self.current_step += skip
                
            if self.current_step >= len(self.program):
                cmd = None
                break
                
            statement = self.program[self.current_step]
            cmd = statement[0]
            arg = statement[1] if len(statement) > 1 else ''     
            skip = statement[2] if len(statement) > 2 else 0
            
        if cmd == 'rl':
            self.robot.rotate(-90)
        elif cmd == 'rr':
            self.robot.rotate(90)
        elif cmd == 'fd':
            self.robot.move_forward()
        elif cmd =='sh':
            self.robot.shoot(15)
        else:
            raise RobotRuntimeException('Unknown command - {}'.format(cmd))
            
        self.current_step += 1
            
    def __evaluate(self, condition):
{'fraction_non_alphanumeric': 0.09774647887323944, 'fraction_numerical': 0.012394366197183098, 'mean_word_length': 1.5310049893086244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1024771', 'n_tokens_mistral': 978, 'n_tokens_neox': 937, 'n_words': 223}