<commit_before>// Foundation not needed

// Apple Swift version 2.1

enum CardinalDirection {
    case North
    case East
    case South
    case West
    
    static let allValues: [CardinalDirection] = [.North, .East, .South, .West]
}

class SimulatedRobot {
    var bearing: CardinalDirection = .North
    var x: Int = 0
    var y: Int = 0
    var coordinates: [Int] {
        return [x, y]
    }
    
    func orient(bearing: CardinalDirection) {
        self.bearing = bearing
    }
    
    func turnRight() {
        if let index = CardinalDirection.allValues.indexOf(bearing) {
            let newIndex = (index + 1) % 4
            bearing = CardinalDirection.allValues[newIndex]
        }
    }
    
    func turnLeft() {
        if let index = CardinalDirection.allValues.indexOf(bearing) {
            var newIndex = (index - 1) % 4
            if newIndex < 0 {
                newIndex += 4
            }
            bearing = CardinalDirection.allValues[newIndex]
        }
    }
    
    func at(x x: Int, y: Int) {
        self.x = x
        self.y = y
    }
    
    func advance() {
        switch bearing {
            // Note: ++ and -- will be deprecated in Swift 2.2 and removed in Swift 3.0
            // See https://github.com/apple/swift-evolution/blob/master/proposals/0004-remove-pre-post-inc-decrement.md
            case .North: y += 1
            case .East:  x += 1
            case .South: y -= 1
            case .West:  x -= 1
        }
    }
}

enum RobotInstruction: String {
    case TurnLeft  = "L"
    case TurnRight = "R"
    case Advance   = "A"
}

struct Simulator {
    
    func instructions(instructions: String) -> [RobotInstruction] {
        var result = [RobotInstruction]()
        
        let characters = instructions.characters.map { String($0) }
        
        for character in characters {
            if let instruction = RobotInstruction(rawValue: character) {<commit_msg>Move RobotInstruction enum into Simulator struct<commit_after>// Foundation not needed

// Apple Swift version 2.1

enum CardinalDirection {
    case North
    case East
    case South
    case West
    
    static let allValues: [CardinalDirection] = [.North, .East, .South, .West]
}

class SimulatedRobot {
    
    var bearing: CardinalDirection = .North
    var x: Int = 0
    var y: Int = 0
    var coordinates: [Int] {
        return [x, y]
    }
    
    func orient(bearing: CardinalDirection) {
        self.bearing = bearing
    }
    
    func turnRight() {
        if let index = CardinalDirection.allValues.indexOf(bearing) {
            let newIndex = (index + 1) % 4
            bearing = CardinalDirection.allValues[newIndex]
        }
    }
    
    func turnLeft() {
        if let index = CardinalDirection.allValues.indexOf(bearing) {
            var newIndex = (index - 1) % 4
            if newIndex < 0 {
                newIndex += 4
            }
            bearing = CardinalDirection.allValues[newIndex]
        }
    }
    
    func at(x x: Int, y: Int) {
        self.x = x
        self.y = y
    }
    
    func advance() {
        switch bearing {
            // Note: ++ and -- will be deprecated in Swift 2.2 and removed in Swift 3.0
            // See https://github.com/apple/swift-evolution/blob/master/proposals/0004-remove-pre-post-inc-decrement.md
            case .North: y += 1
            case .East:  x += 1
            case .South: y -= 1
            case .West:  x -= 1
        }
    }
    
}

struct Simulator {
    
    enum RobotInstruction: String {
        case TurnLeft  = "L"
        case TurnRight = "R"
        case Advance   = "A"
    }
    
    func instructions(instructions: String) -> [RobotInstruction] {
        var result = [RobotInstruction]()
        
        let characters = instructions.characters.map { String($0) }
        
        for character in characters {
            if let instruction = RobotInstruction(rawValue: character) {
{'fraction_non_alphanumeric': 0.097994414826098, 'fraction_numerical': 0.011678090886011678, 'mean_word_length': 1.6802721088435375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '3737891', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1136, 'n_words': 327}