Skip to content

Instantly share code, notes, and snippets.

@mplewis
Created December 24, 2012 07:53
Show Gist options
  • Save mplewis/4368274 to your computer and use it in GitHub Desktop.
Save mplewis/4368274 to your computer and use it in GitHub Desktop.
gibe money plox. This is just for fun, really.
#!/usr/bin/python2
# GIBE MONY PLOX. -mplewis
import random
import sys
from time import sleep
from math import log
numHue = 100 # LOL THIS DOESN'T MATTER
minLength = 3
maxLength = 7
pctChanceEndInH = 30
hueDistr = {3: 5, 4: 3, 5: 2}
nextLetterPoss = { \
'E': ['A', 'U'],
'A': ['U', 'E'],
'U': ['E', 'A']
}
base = 'HU'
for n in range(minLength, maxLength + 1):
if not n in hueDistr:
hueDistr[n] = 1
hueDistrList = []
for n in hueDistr:
numTimes = hueDistr[n]
while numTimes > 0:
hueDistrList.append(n)
numTimes -= 1
def lastLetter(string):
return string[len(string) - 1]
numHues = 0
#for n in range(numHue):
while True:
numHues += 1
invTimeToSleep = (log(numHues * 50) / 10)
if invTimeToSleep >= 1:
timeToSleep = 0.001
else:
timeToSleep = 1 - invTimeToSleep
numLetters = random.randint(-3, 7)
if numLetters < 3:
numLetters = 3
hueStr = base
while len(hueStr) < numLetters:
lettersToGo = numLetters - len(hueStr)
if numLetters > 3 and lettersToGo == 1 and pctChanceEndInH > random.randint(0, 99):
nextLetter = 'H'
else:
nextLetter = random.choice(nextLetterPoss[lastLetter(hueStr)])
hueStr += nextLetter
print hueStr,
sys.stdout.flush()
sleep(timeToSleep)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment