this post was submitted on 06 Nov 2024
39 points (100.0% liked)

Stardew Valley

477 readers
245 users here now

Welcome to Stardew Valley Lemmy and Mbin Community.

This community is for the game Stardew Valley, which is developed and published by ConcernedApe. Feel free to post Arts, Question or Your farm. Also make sure you read our rules before posting.

Rules:


Official Links

Purchase Links

Tools and Resources

founded 2 weeks ago
MODERATORS
 

Thank you @[email protected] !

top 8 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 7 hours ago (1 children)

For fun, I just ported it to Python

source

from random import random
import math

startStrings = [
  "B",
  "Br",
  "J",
  "F",
  "S",
  "M",
  "C",
  "Ch",
  "L",
  "P",
  "K",
  "W",
  "G",
  "Z",
  "Tr",
  "T",
  "Gr",
  "Fr",
  "Pr",
  "N",
  "Sn",
  "R",
  "Sh",
  "St"
]
connectiveStrings = [
  "ll",
  "tch",
  "l",
  "m",
  "n",
  "p",
  "r",
  "s",
  "t",
  "c",
  "rt",
  "ts"
]

vowelStrings = [
  "a",
  "e",
  "i",
  "o",
  "u"
]

endStrings = [
  "ie",
  "o",
  "a",
  "ers",
  "ley"
]
vowelDictionary1 = {
  "a": [
    "nie",
    "bell",
    "bo",
    "boo",
    "bella",
    "s"
  ],
  "e": [
    "ll",
    "llo",
    "",
    "o"
  ],
  "i": [
    "ck",
    "e",
    "bo",
    "ba",
    "lo",
    "la",
    "to",
    "ta",
    "no",
    "na",
    "ni",
    "a",
    "o",
    "zor",
    "que",
    "ca",
    "co",
    "mi"
  ],
  "o": [
    "nie",
    "ze",
    "dy",
    "da",
    "o",
    "ver",
    "la",
    "lo",
    "s",
    "ny",
    "mo",
    "ra"
  ],
  "u": [
    "rt",
    "mo",
    "",
    "s"
  ]
}

vowelDictionary2 = {
  "a": [
    "nny",
    "sper",
    "trina",
    "bo",
    "-bell",
    "boo",
    "lbert",
    "sko",
    "sh",
    "ck",
    "ishe",
    "rk"
  ],
  "e": [
    "lla",
    "llo",
    "rnard",
    "cardo",
    "ffe",
    "ppo",
    "ppa",
    "tch",
    "x"
  ],
  "i": [
    "llard",
    "lly",
    "lbo",
    "cky",
    "card",
    "ne",
    "nnie",
    "lbert",
    "nono",
    "nano",
    "nana",
    "ana",
    "nsy",
    "msy",
    "skers",
    "rdo",
    "rda",
    "sh"
  ],
  "o": [
    "nie",
    "zzy",
    "do",
    "na",
    "la",
    "la",
    "ver",
    "ng",
    "ngus",
    "ny",
    "-mo",
    "llo",
    "ze",
    "ra",
    "ma",
    "cco",
    "z"
  ],
  "u": [
    "ssie",
    "bbie",
    "ffy",
    "bba",
    "rt",
    "s",
    "mby",
    "mbo",
    "mbus",
    "ngus",
    "cky"
  ]
}

def randomNumberBetween(bottom, top):
  diff = top - bottom
  rando = math.floor(random() * (diff))
  return rando + bottom

def randomNumberNext(num):
  return randomNumberBetween(0, num)

def randoNext(num1, num2 = None):
  if (num2 == None):
    return randomNumberNext(num1)
  else:
    return randomNumberBetween(num1, num2)

def namer():
  source = ""
  str1 = ""
  num = randoNext(3, 6)

  # Get start of string
  source = str1 + startStrings[randoNext(len(startStrings) - 1)]

  # Add some chars from array 2 or array 3
  for index in range(1, num - 1):
    source = source + vowelStrings[randoNext(len(vowelStrings))] if index % 2 != 0 else source + connectiveStrings[randoNext(len(connectiveStrings))]

    # Stop if greater than the number
    if (len(source) >= num):
      break

  char = ''
  currentLastLetter = source[len(source) - 1]

  # if last letter is not a vowel and 50% chance, add some letters
  if (random() < 0.5 and (currentLastLetter not in vowelStrings)):
    source += endStrings[randoNext(len(endStrings))]

  # otherwise if the last letter is a vowel
  elif (currentLastLetter in vowelStrings):
    # if 80 percent chance
    if (random() < 0.8):
      newCurrentLastLetter = source[len(source) - 1]
      char = newCurrentLastLetter

      # if its short add something from voweldict2
      if len(source) <= 3:
        maxValue = len(vowelDictionary2[char]) - 1
        index2 = randoNext(maxValue)
        str3 = vowelDictionary2[newCurrentLastLetter][index2]

        source = source + str3
      # if its long add something from voweldict1
      else:
        maxValue = len(vowelDictionary1[char]) - 1
        index2 = randoNext(maxValue)
        str3 = vowelDictionary1[newCurrentLastLetter][index2]

        source = source + str3
  # otherwise add a vowel
  else:
    source += vowelStrings[randoNext(len(vowelStrings))]

  # from end of the source, every character
  for index in range(len(source) - 1, 2):
    # get the character
    char = source[index];
    
    # if its a vowel
    if char in vowelStrings:
      # get the two to last letter
      char = source[index - 2]
      
      # if its also a vowel
      if char in vowelStrings:
        # find the letter in between and add a letter to it
        # so "noco" turns into "nocko" etc
        char = source[index - 1]
        match char:
          case 'c' | 'r':
            source = source[0, index] + 'k' + source[index]
            index -= 1
            continue
          case 'l':
            source = source[0, index] + 'n' + source[index]
            index -= 1
            continue
          case _:
            continue

  # small percent chance of doubling the string if its shourt. a la ka-ka
  if len(source) <= 3 and random() < 0.1:
    source = source + source if random() < 0.5 else source + '-' + source

  # maybe add an m, p, or b, if there's an e at the end
  if len(source) <= 2 and source[len(source) - 1] == 'e':
    source += 'm' if random() < 0.3 else 'p' if random() < 0.5 else 'b'

  # blacklist words
  blacklist = [
    'sex',
    'taboo',
    'fuck',
    'rape',
    'cock',
    'willy',
    'cum',
    'goock',
    'trann',
    'gook',
    'bitch',
    'shit',
    'pusie',
    'kike',
    'nigg',
    'puss'
  ]
  for expletive in blacklist:
    if expletive in source:
      source = 'Bobo' if random() > 0.5 else 'Wumbus'

  return source
  
if __name__ == '__main__':
  print(namer())

[–] [email protected] 2 points 1 hour ago* (last edited 1 hour ago) (1 children)

Cool, I am gonna put in on my Codeberg. It's now our code. XD

[–] [email protected] 1 points 1 hour ago

Feel free. I claim no ownership

[–] [email protected] 10 points 1 day ago* (last edited 7 hours ago)

Interestingly, it replaces any result containing an expletive with either "Bobo" or "Wumbus"

source

const startStrings = [
  "B",
  "Br",
  "J",
  "F",
  "S",
  "M",
  "C",
  "Ch",
  "L",
  "P",
  "K",
  "W",
  "G",
  "Z",
  "Tr",
  "T",
  "Gr",
  "Fr",
  "Pr",
  "N",
  "Sn",
  "R",
  "Sh",
  "St"
]
const connectiveStrings = [
  "ll",
  "tch",
  "l",
  "m",
  "n",
  "p",
  "r",
  "s",
  "t",
  "c",
  "rt",
  "ts"
]

const vowelStrings = [
  "a",
  "e",
  "i",
  "o",
  "u"
]

const endStrings = [
  "ie",
  "o",
  "a",
  "ers",
  "ley"
]
const vowelDictionary1 = {
  a: [
    "nie",
    "bell",
    "bo",
    "boo",
    "bella",
    "s"
  ],
  e: [
    "ll",
    "llo",
    "",
    "o"
  ],
  i: [
    "ck",
    "e",
    "bo",
    "ba",
    "lo",
    "la",
    "to",
    "ta",
    "no",
    "na",
    "ni",
    "a",
    "o",
    "zor",
    "que",
    "ca",
    "co",
    "mi"
  ],
  o: [
    "nie",
    "ze",
    "dy",
    "da",
    "o",
    "ver",
    "la",
    "lo",
    "s",
    "ny",
    "mo",
    "ra"
  ],
  u: [
    "rt",
    "mo",
    "",
    "s"
  ]
}

const vowelDictionary2 = {
  a: [
    "nny",
    "sper",
    "trina",
    "bo",
    "-bell",
    "boo",
    "lbert",
    "sko",
    "sh",
    "ck",
    "ishe",
    "rk"
  ],
  e: [
    "lla",
    "llo",
    "rnard",
    "cardo",
    "ffe",
    "ppo",
    "ppa",
    "tch",
    "x"
  ],
  i: [
    "llard",
    "lly",
    "lbo",
    "cky",
    "card",
    "ne",
    "nnie",
    "lbert",
    "nono",
    "nano",
    "nana",
    "ana",
    "nsy",
    "msy",
    "skers",
    "rdo",
    "rda",
    "sh"
  ],
  o: [
    "nie",
    "zzy",
    "do",
    "na",
    "la",
    "la",
    "ver",
    "ng",
    "ngus",
    "ny",
    "-mo",
    "llo",
    "ze",
    "ra",
    "ma",
    "cco",
    "z"
  ],
  u: [
    "ssie",
    "bbie",
    "ffy",
    "bba",
    "rt",
    "s",
    "mby",
    "mbo",
    "mbus",
    "ngus",
    "cky"
  ]
}

const randomNumberBetween = (bottom, top) => {
  const diff = top - bottom
  const rando = Math.floor(Math.random() * (diff))
  return rando + bottom
}

const randomNumberNext = (num) => randomNumberBetween(0, num)

const randoNext = (num1, num2) => {
  if (num2 === undefined) return randomNumberNext(num1)
  else return randomNumberBetween(num1, num2)
}


function namer(){
  let source = ""
  let str1 = ""
  const num = randoNext(3, 6)

  // Get start of string
  source = str1 + startStrings[randoNext(startStrings.length - 1)]

  // Add some chars from array 2 or array 3
  for (let index = 1; index < num - 1; index++) {
    source = index % 2 != 0 ? 
      source + vowelStrings[randoNext(vowelStrings.length)] : 
      source + connectiveStrings[randoNext(connectiveStrings.length)]

    // Stop if greater than the number
    if (source.length >= num) break;
  }

  let char = ''
  let currentLastLetter = source[source.length - 1]

  // if last letter is not a vowel and 50% chance, add some letters
  if (Math.random() < 0.5 && !(vowelStrings.includes(currentLastLetter))) {
    source += endStrings[randoNext(endStrings.length)]
  }

  // otherwise if the last letter is a vowel
  else if (vowelStrings.includes(currentLastLetter)) {
    // if 80 percent chance
    if (Math.random() < 0.8) {
      let newCurrentLastLetter = source[source.length - 1]
      char = newCurrentLastLetter

      // if its short add something from voweldict2
      if (source.length <= 3) {

        const maxValue = vowelDictionary2[char].length - 1
        const index2 = randoNext(maxValue)
        const str3 = vowelDictionary2[newCurrentLastLetter][index2]

        source = source + str3
      }
      // if its long add something from voweldict1
      else {
        const maxValue = vowelDictionary1[char].length - 1
        const index2 = randoNext(maxValue)
        const str3 = vowelDictionary1[newCurrentLastLetter][index2]

        source = source + str3
      }
    }
  }
  // otherwise add a vowel
  else {
    source += vowelStrings[randoNext(vowelStrings.length)]
  }

  // from end of the source, every character
  for (let index = source.length - 1; index > 2; index--) {

    // get the character
    char = source[index];
    
    // if its a vowel
    if (vowelStrings.includes(char)) {

      // get the two to last letter
      char = source[index - 2]
      
      // if its also a vowel
      if (vowelStrings.includes(char)) {
        
        // find the letter in between and add a letter to it

        // so "noco" turns into "nocko" etc

        char = source[index - 1]
        switch (char) {
          case 'c':
            source = source.substring(0, index) + 'k' + source.substring(index);
            --index;
            continue;
          case 'l':
            source = source.substring(0, index) + 'n' + source.substring(index);
            --index;
            continue;
          case 'r':
            source = source.substring(0, index) + 'k' + source.substring(index);
            --index;
            continue;
          default:
            continue;
        }
      }
    }
  }

  // small percent chance of doubling the string if its shourt. a la ka-ka
  if (source.length <= 3 && Math.random() < 0.1) {
    source = Math.random() < 0.5 ? source + source : source + '-' + source;
  }

  // maybe add an m, p, or b, if there's an e at the end
  if (source.length <= 2 && source[source.length - 1] === 'e') {
    source+= Math.random() < 0.3 ? 'm' : ( Math.random() < 0.5 ? 'p' : 'b')
  }

  // blacklist words
  [
    'sex',
    'taboo',
    'fuck',
    'rape',
    'cock',
    'willy',
    'cum',
    'goock',
    'trann',
    'gook',
    'bitch',
    'shit',
    'pusie',
    'kike',
    'nigg',
    'puss'
  ].forEach(expletive => {
    if (source.includes(expletive)) {
      source = Math.random() > 0.5 ? 'Bobo' : 'Wumbus'
    }
  })

  return source
}

[–] [email protected] 2 points 17 hours ago

Oh man I know some people who are going to be very pleased about this.

[–] [email protected] 4 points 1 day ago (1 children)

I am gonna put this to Sidebar.

[–] [email protected] 4 points 1 day ago (1 children)

I suggest to also add this link for some fan-made fonts to the tools in the sidebar

https://fontswan.com/stardew-valley-font/

[–] [email protected] 4 points 1 day ago

LMAO, I was also thinking that. Even downloaded every SDV Font I can find.