<commit_before>package towerfall

import "math/rand"

type Levels map[string][]string

// Because of reasons, there is a difference between the level names
// in the app and in the game. This map translates the app names to
// the game names. Sorry.
var realNames map[string]string

func init() {
	realNames = make(map[string]string)
	realNames["sacred"] = "SacredGround" // Won't happen, but thorough
	realNames["twilight"] = "TwilightSpire"
	realNames["backfire"] = "Backfire"
	realNames["flight"] = "Flight"
	realNames["mirage"] = "Mirage"
	realNames["thornwood"] = "Thornwood"
	realNames["frostfang"] = "FrostfangKeep"
	realNames["moonstone"] = "Moonstone"
	realNames["kingscourt"] = "KingsCourt"
	realNames["sunken"] = "SunkenCity"
	realNames["towerforge"] = "TowerForge"
	realNames["ascension"] = "Ascension"
	realNames["amaranth"] = "TheAmaranth"
	realNames["dreadwood"] = "Dreadwood"
	realNames["darkfang"] = "Darkfang"
	realNames["cataclysm"] = "Cataclysm"
}

// NewLevels returns a newly shuffled set of levels
//
// This returns a new discrete set of levels so that tournaments won't
// re-use them.
func NewLevels() Levels {
	levels := make(Levels)

	levels[playoff] = []string{
		"twilight",
		"backfire",
		"flight",
		"mirage",
		"thornwood",
		"frostfang",
		"moonstone",
		"kingscourt",
	}

	levels[semi] = []string{
		"sunken",
		"towerforge",
		"ascension",
		"amaranth",
		"dreadwood",
		"darkfang",
	}

	levels[final] = []string{
		"cataclysm",
	}

	shuffle(levels[playoff])
	shuffle(levels[semi])
	shuffle(levels[final])

	return levels
}

// shuffle ...
func shuffle(s []string) {
	n := len(s)
	for i := 0; i < n; i++ {
		r := i + rand.Intn(n-i)
		s[r], s[i] = s[i], s[r]
	}
}<commit_msg>Move level shuffling logic to the databaz<commit_after>package towerfall

type Levels map[string][]string

// Because of reasons, there is a difference between the level names
// in the app and in the game. This map translates the app names to
// the game names. Sorry.
var realNames map[string]string

func init() {
	realNames = make(map[string]string)
	realNames["sacred"] = "SacredGround" // Won't happen, but thorough
	realNames["twilight"] = "TwilightSpire"
	realNames["backfire"] = "Backfire"
	realNames["flight"] = "Flight"
	realNames["mirage"] = "Mirage"
	realNames["thornwood"] = "Thornwood"
	realNames["frostfang"] = "FrostfangKeep"
	realNames["moonstone"] = "Moonstone"
	realNames["kingscourt"] = "KingsCourt"
	realNames["sunken"] = "SunkenCity"
	realNames["towerforge"] = "TowerForge"
	realNames["ascension"] = "Ascension"
	realNames["amaranth"] = "TheAmaranth"
	realNames["dreadwood"] = "Dreadwood"
	realNames["darkfang"] = "Darkfang"
	realNames["cataclysm"] = "Cataclysm"
}
{'fraction_non_alphanumeric': 0.15937731653076354, 'fraction_numerical': 0.00037064492216456633, 'mean_word_length': 5.134090909090909, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4077875', 'n_tokens_mistral': 1050, 'n_tokens_neox': 994, 'n_words': 234}