Created
December 6, 2015 06:46
-
-
Save asfaltboy/734d42d4a14171e5a5cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this method | |
def run(self): | |
for i in range(0,4): | |
if i == 0: | |
self.geneTranslation.extend(["f"] * self.genes[0]) | |
elif i == 1: | |
self.geneTranslation.extend(["b"] * self.genes[1]) | |
elif i == 2: | |
self.geneTranslation.extend(["r"] * self.genes[2]) | |
elif i == 3: | |
self.geneTranslation.extend(["l"] * self.genes[3]) | |
r.shuffle(self.geneTranslation) | |
for x in range(1,20): | |
try: | |
self.thisTime = r.choice(self.geneTranslation) | |
self.move(self.thisTime) | |
except: | |
pass | |
# should equal : | |
def run(self): | |
""" Update genese and perform move 20 times """ | |
self.geneTranslation.extend(["f"] * self.genes[0]) | |
self.geneTranslation.extend(["b"] * self.genes[1]) | |
self.geneTranslation.extend(["r"] * self.genes[2]) | |
self.geneTranslation.extend(["l"] * self.genes[3]) | |
for x in range(1,20): | |
self.thisTime = r.choice(self.geneTranslation) | |
self.move(self.thisTime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment