2.01.2007

quick python port of zep.pl

just a quick port of stevenf’s zep.pl.

wow, it’s been a long time since i’ve read or written perl.

#!/usr/bin/env python

# quick port of zep.pl
# http://stevenf.com/2007/01/zeppl_1.php

import random

words = ( "hey", "mama", "said", "the",
"way", "you", "move", "gonna",
"make", "sweat", "groove" )

success = ( 0, 0, 1, 2, 3, 4, 5, 6,
7, 8, 5, 9, 7, 8, 5, 10 )

random.seed()

iterations = 1
matched = [False] * 16

while True:
matches = 0
i = 0
print "[%s]" % iterations,

while i < 16:
if matched[i]:
matches += 1
print words[success[i]],
else:
r = random.randint(0, 10)
print words[r],

if r == success[i]:
matched[i] = True
matches += 1

i += 1

print

if matches == 16:
break

iterations += 1


print "*** Black Dog achieved",
print "in %s pyZepMarks ***" % iterations