Skip to content

Commit 8f79267

Browse files
Temporary fix for issue 188.
1 parent 2841f1a commit 8f79267

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

neat/attributes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Deals with the attributes (variable parameters) of genes"""
2+
from copy import deepcopy
23
from random import choice, gauss, random, uniform, randint
34

45
from neat.config import ConfigParameter
@@ -12,6 +13,8 @@ class BaseAttribute(object):
1213

1314
def __init__(self, name, **default_dict):
1415
self.name = name
16+
# Create instance-level copy to avoid sharing between instances (fixes GitHub issue #188)
17+
self._config_items = deepcopy(self.__class__._config_items)
1518
# TODO: implement a mechanism that allows us to detect and report unused configuration items.
1619
for n, default in default_dict.items():
1720
self._config_items[n] = [self._config_items[n][0], default]

0 commit comments

Comments
 (0)