Last active
October 3, 2019 10:34
-
-
Save fyr91/3bb536e1ed9de5aa2169d25ff626cfb4 to your computer and use it in GitHub Desktop.
This file contains 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
import numpy as np | |
import namegenerator | |
from copy import deepcopy | |
# dummy lineup class | |
class Lineup: | |
def __init__(self, score, gene=''): | |
# name only used to differentiate the lineup | |
self.name = namegenerator.gen() | |
if len(gene): | |
self.gene = gene | |
else: | |
self.gene = np.random.randint(2, size=20) | |
self.combat_power = np.count_nonzero(self.gene == 1) | |
self.score = score | |
def to_dict(self): | |
return {"name": self.name, | |
"gene": ''.join(list(map(str, self.gene))), | |
"combat_power": self.combat_power, | |
"score": self.score} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment