<commit_before>package lila.clas

import scala.util.Random
import scala.concurrent.ExecutionContext

final class NameGenerator(userRepo: lila.user.UserRepo)(implicit ec: ExecutionContext) {

  def apply(maxSize: Int = 16, triesLeft: Int = 100): Fu[Option[String]] = {
    val name = anyOf(combinations).map(anyOf).mkString
    if (name.size <= maxSize) userRepo.nameExists(name) flatMap {
      case true => apply(maxSize, triesLeft - 1)
      case _    => fuccess(name.some)
    }
    else if (triesLeft > 0) apply(maxSize, triesLeft - 1)
    else fuccess(none)
  }

  private def anyOf[A](vec: Vector[A]): A =
    vec(Random.between(0, vec.size))

  lazy val combinations = Vector(
    List(adjectives, nouns)
  )

  val adjectives = colors ++ positiveAdjectives
  val nouns      = animals ++ pieces

  def colors = Vector(
    "Red",
    "Orange",
    "Yellow",
    "Green",
    "Blue",
    "Purple",
    "Brown",
    "Magenta",
    "Tan",
    "Cyan",
    "Olive",
    "Maroon",
    "Navy",
    "Aqua",
    "Turquoise",
    "Silver",
    "Lime",
    "Teal",
    "Indigo",
    "Violet",
    "Pink",
    "Black",
    "White",
    "Gray"
  )

  def pieces = Vector(
    "Pawn",
    "Bishop",
    "Knight",
    "Rook",
    "Queen",
    "King"
  )

  def animals = Vector(
    "Aardvark",
    "Alligator",
    "Alpaca",
    "Ant",
    "Antelope",
    "Ape",
    "Armadillo",
    "Baboon",
    "Badger",
    "Bat",
    "Bear",
    "Bee",
    "Beetle",
    "Bison",
    "Buffalo",
    "Butterfly",
    "Camel",
    "Carabao",
    "Cariboo",
    "Cat",
    "Cattle",
    "Cheetah",
    "Chicken",
    "Chimpanzee",
    "Chinchilla",
    "Cicada",
    "Clam",
    "Cod",
    "Coyote",
    "Crab",
    "Cricket",
    "Crocodile",
    "Crow",
    "Deer",
    "Dinosaur",
    "Dog",
    "Dolphin",
    "Dragon",
    "Duck",
    "Eagle",
    "Echidna",
    "Eel",
    "Elephant",
    "Elk",
    "Ferret",
    "Fish",
    "Fly",
    "Fox",
    "Frog",
    "Gerbil",
    "Giraffe",
    "Gnat",
    "Gnu",
    "Goat",
    "Goldfish",
    "Goose",
    "Gorilla",
    "Grasshopper",
    "Guinea",
    "Hamster",
    "Hare",
    "Hawk",
    "Hedgehog",
    "Herring",
    "Hippopotamus",
    "Hornet",
    "Horse",
    "Hound",
    "Human",
    "Hyena",
    "Impala",
    "Insect",
    "Jackal",
    "Jellyfish",
    "Kangaroo",
    "Koala",
    "Leopard",
    "Lion",
    "Lizard",
    "Llama",
    "Locust",
    "Louse",
    "Macaw",
    "Mallard",
    "Mammoth",
    "Manatee",
    "Marten",
    "Mink",
    "Minnow",
    "Mole",
    "Monkey",
    "Moose",
    "Mosquito",
    "Mouse",
    "Mule",
    "Muskrat",
    "Octopus",
    "Otter",
    "Owl",
    "Ox",
    "Oyster",
    "Panda",
    "Pig",
    "Platypus",
    "Pony",
    "Porcupine",
    "Prairie",
    "Pug",
    "Rabbit",
    "Raccoon",
    "Reindeer",
    "Rhinoceros",
    "Salmon",
    "Sardine",
    "Scorpion",
    "Seal",
    "Serval",
    "Shark",
    "Sheep",
    "Snail",
    "Snake",
    "Spider",
    "Squirrel",
    "Swan",
    "Termite",
    "Tiger",
    "Triceratops",
    "Trout",
    "Turtle",
    "Unicorn",
    "Walrus",
    "Wasp",
    "Weasel",
    "Whale",
    "Wolf",
    "Wombat",
    "Woodchuck",
    "Worm",
    "Yak",
    "Yellowjacket",
    "Zebra"
  )

  def positiveAdjectives = Vector(
    "Abiding",
    "Able",
    "Absolute",
    "Absolved",
    "Abundant",
    "Academic",
    "Accepted",
    "Accurate",
    "Active",
    "Actual",
    "Acute",
    "Adamant",
    "Adept",
    "Adequate",
    "Adjusted",
    "Admired",
    "Adonic",
    "Adorable",
    "Adored",
    "Adroit",<commit_msg>Add some fantasy creatures<commit_after>package lila.clas

import scala.util.Random
import scala.concurrent.ExecutionContext

final class NameGenerator(userRepo: lila.user.UserRepo)(implicit ec: ExecutionContext) {

  def apply(maxSize: Int = 16, triesLeft: Int = 100): Fu[Option[String]] = {
    val name = anyOf(combinations).map(anyOf).mkString
    if (name.size <= maxSize) userRepo.nameExists(name) flatMap {
      case true => apply(maxSize, triesLeft - 1)
      case _    => fuccess(name.some)
    }
    else if (triesLeft > 0) apply(maxSize, triesLeft - 1)
    else fuccess(none)
  }

  private def anyOf[A](vec: Vector[A]): A =
    vec(Random.between(0, vec.size))

  lazy val combinations = Vector(
    List(adjectives, nouns)
  )

  val adjectives = colors ++ positiveAdjectives
  val nouns      = animals ++ pieces

  def colors = Vector(
    "Red",
    "Orange",
    "Yellow",
    "Green",
    "Blue",
    "Purple",
    "Brown",
    "Magenta",
    "Tan",
    "Cyan",
    "Olive",
    "Maroon",
    "Navy",
    "Aqua",
    "Turquoise",
    "Silver",
    "Lime",
    "Teal",
    "Indigo",
    "Violet",
    "Pink",
    "Black",
    "White",
    "Gray"
  )

  def pieces = Vector(
    "Pawn",
    "Bishop",
    "Knight",
    "Rook",
    "Queen",
    "King"
  )

  def animals = Vector(
    "Aardvark",
    "Alligator",
    "Alpaca",
    "Ant",
    "Antelope",
    "Ape",
    "Armadillo",
    "Baboon",
    "Badger",
    "Bat",
    "Bear",
    "Bee",
    "Beetle",
    "Bison",
    "Buffalo",
    "Butterfly",
    "Camel",
    "Carabao",
    "Cariboo",
    "Cat",
    "Cattle",
    "Centaur",
    "Cheetah",
    "Chicken",
    "Chimpanzee",
    "Chinchilla",
    "Cicada",
    "Clam",
    "Cod",
    "Coyote",
    "Crab",
    "Cricket",
    "Crocodile",
    "Crow",
    "Deer",
    "Dinosaur",
    "Dog",
    "Dolphin",
    "Dragon",
    "Duck",
    "Eagle",
    "Echidna",
    "Eel",
    "Elephant",
    "Elf",
    "Elk",
    "Ferret",
    "Fish",
    "Fly",
    "Fox",
    "Frog",
    "Gerbil",
    "Giraffe",
    "Gnat",
    "Gnu",
    "Goat",
    "Goblin",
    "Goldfish",
    "Goose",
    "Gorilla",
    "Grasshopper",
    "Griffin",
    "Guinea",
    "Hamster",
    "Hare",
    "Hawk",
    "Hedgehog",
    "Herring",
    "Hippopotamus",
    "Hornet",
    "Horse",
    "Hound",
    "Human",
    "Hyena",
    "Impala",
    "Insect",
    "Jackal",
    "Jellyfish",
    "Kangaroo",
    "Koala",
    "Leopard",
    "Lion",
    "Lizard",
    "Llama",
    "Locust",
    "Louse",
    "Macaw",
    "Mallard",
    "Mammoth",
    "Manatee",
    "Marten",
    "Mink",
    "Minotaur",
    "Minnow",
    "Mole",
    "Monkey",
    "Moose",
    "Mosquito",
    "Mouse",
    "Mule",
    "Muskrat",
    "Octopus",
    "Otter",
    "Owl",
    "Ox",
    "Oyster",
    "Panda",
    "Pig",
    "Platypus",
    "Pony",
    "Porcupine",
    "Prairie",
    "Pug",
    "Rabbit",
    "Raccoon",
    "Reindeer",
    "Rhinoceros",
    "Salmon",
    "Sardine",
    "Scorpion",
    "Seal",
    "Serval",
    "Shark",
    "Sheep",
    "Snail",
    "Snake",
    "Sphinx",
    "Spider",
    "Squirrel",
    "Swan",
    "Termite",
    "Tiger",
    "Triceratops",
    "Troll",
    "Trout",
    "Turtle",
    "Unicorn",
    "Walrus",
    "Wasp",
    "Weasel",
    "Werewolf",
    "Whale",
    "Wolf",
    "Wombat",
    "Woodchuck",
    "Worm",
    "Yak",
    "Yellowjacket",
    "Zebra"
  )

  def positiveAdjectives = Vector(
    "Abiding",
    "Able",
    "Absolute",
    "Absolved",
    "Abundant",
    "Academic",
    "Accepted",
    "Accurate",
    "Active",
    "Actual",
    "Acute",
    "Adamant",
    "Adept",
    "Adequate",
    "Adjusted",
    "Admired",
    "Adonic",
    "Adorable",
    "Adored",
    "Adroit",
{'fraction_non_alphanumeric': 0.18969072164948453, 'fraction_numerical': 0.002474226804123711, 'mean_word_length': 2.070042194092827, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6070237', 'n_tokens_mistral': 3158, 'n_tokens_neox': 3044, 'n_words': 546}