Advertisement
WayGroovy

MC TerrainControl BiomeMaker PY Script

May 6th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.12 KB | None | 0 0
  1. import random
  2. import sys
  3.  
  4. vowels = ['a', 'e', 'i', 'o', 'u']
  5. consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']
  6. hexchar = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
  7.  
  8. def _vowel():
  9.     return random.choice(vowels)
  10.  
  11. def _consonant():
  12.     return random.choice(consonants)
  13.  
  14. def _cv():
  15.     return _consonant() + _vowel()
  16.  
  17. def _cvc():
  18.     return _cv() + _consonant()
  19.  
  20. def _syllable():
  21.     return random.choice([_vowel, _cv, _cvc])()
  22.  
  23. def create_fake_word():
  24.     """ This function generates a fake word by creating between two and three
  25.        random syllables and then joining them together.
  26.    """
  27.     syllables = []
  28.     for x in range(random.randint(3,5)):
  29.         syllables.append(_syllable())
  30.     return ''.join(syllables)
  31.  
  32. def _hexchar():
  33.     return random.choice(hexchar)
  34.  
  35. def colorval():
  36.     colorvalues = []
  37.     for x in range(0,6):
  38.         colorvalues.append(_hexchar())
  39.     return ''.join(colorvalues)
  40.  
  41. if __name__ == '__main__':
  42.     filename = str.capitalize(create_fake_word())
  43.     filename += 'Config.ini'
  44.     fo = open(filename, 'wb')
  45.     biomesize = 'BiomeSize:'
  46.     biomesize += str(random.randint(3,10))
  47.     fo.write(biomesize)
  48.     fo.write('\n')
  49.     biomerarity = 'BiomeRarity:'
  50.     biomerarity += str(random.randint(25,75))
  51.     fo.write(biomerarity)
  52.     fo.write('\n')
  53.     fo.write('BiomeIsBorder:')
  54.     fo.write('\n')
  55.     fo.write('NotBorderNear:')
  56.     fo.write('\n')
  57.     biometemperature = 'BiomeTemperature:'
  58.     biometemperature += str(round(random.uniform(0.0, 1.1), 1))
  59.     fo.write(biometemperature)
  60.     fo.write('\n')
  61.     biomewetness = 'BiomeWetness:'
  62.     biomewetness += str(round(random.uniform(0.0, 1.1), 1))
  63.     fo.write(biomewetness)
  64.     fo.write('\n')
  65.     biomeheight = 'BiomeHeight:'
  66.     biomeheight += str(round(random.gauss(-10.0, 10.1), 1))
  67.     fo.write(biomeheight)
  68.     fo.write('\n')
  69.     biomevolatility = 'BiomeVolatility:'
  70.     biomevolatility += str(round(random.gauss(0.0,1.1),1))
  71.     fo.write(biomevolatility)
  72.     fo.write('\n')
  73.     fo.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement