<commit_before>package enigma

import (
	"fmt"
	"strings"
	"unicode"
)

// The Enigma Machine
type Enigma struct {
	rotors    rotors
	reflector rotor
	plugs     plugs
}

// New returns an instance of the Enigma machine initialised with sensible defaults.
// Left Rotor: I. Middle Rotor: II. Right Rotor: III. Reflector: B. No plugs.
func New() Enigma {
	leftRotor := availableRotors["I"]
	middleRotor := availableRotors["II"]
	rightRotor := availableRotors["III"]
	reflector := availableReflectors["B"]

	return Enigma{
		rotors: rotors{
			&leftRotor,
			&middleRotor,
			&rightRotor,
		},
		reflector: reflector,
	}
}

// Encode takes the input string, encodes each letter in turn and returns the result.
// Input characters that are not letters are ignored.
func (e Enigma) Encode(input string) string {
	result := ""

	count := 0

	for _, letter := range strings.ToUpper(input) {
		if letter < 'A' || letter > 'Z' {
			continue
		}

		// Every 5 letters add a space<commit_msg>Corrected the names of rotor variables in New()<commit_after>package enigma

import (
	"fmt"
	"strings"
	"unicode"
)

// The Enigma Machine
type Enigma struct {
	rotors    rotors
	reflector rotor
	plugs     plugs
}

// New returns an instance of the Enigma machine initialised with sensible defaults.
// Left Rotor: I. Middle Rotor: II. Right Rotor: III. Reflector: B. No plugs.
func New() Enigma {
	leftRotor := availableRotors["III"]
	middleRotor := availableRotors["II"]
	rightRotor := availableRotors["I"]
	reflector := availableReflectors["B"]

	return Enigma{
		rotors: rotors{
			&rightRotor,
			&middleRotor,
			&leftRotor,
		},
		reflector: reflector,
	}
}

// Encode takes the input string, encodes each letter in turn and returns the result.
// Input characters that are not letters are ignored.
func (e Enigma) Encode(input string) string {
	result := ""

	count := 0

	for _, letter := range strings.ToUpper(input) {
		if letter < 'A' || letter > 'Z' {
			continue
		}

		// Every 5 letters add a space
{'fraction_non_alphanumeric': 0.1092184368737475, 'fraction_numerical': 0.002004008016032064, 'mean_word_length': 3.580275229357798, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2784729', 'n_tokens_mistral': 698, 'n_tokens_neox': 649, 'n_words': 226}