Skip to content

Commit

Permalink
edit parent spawning and decision heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
Kcunningham20 committed Apr 28, 2018
1 parent 4b368e2 commit f757f85
Show file tree
Hide file tree
Showing 34 changed files with 1,204 additions and 2,324 deletions.
2 changes: 1 addition & 1 deletion virtupet/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions virtupet/Pudgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,15 @@ def select_parents(active_agent_list):
high_happiness = []
parents = []
for pudgi in active_agent_list:
if pudgi.happiness > .8:
high_happiness.append(pudgi.uid)
if pudgi.happiness > 9:
high_happiness.append(pudgi)
for i in range(len(high_happiness)):
if len(high_happiness) >= 2:
parents.append((high_happiness.pop(), high_happiness.pop()))
parent01 = high_happiness.pop()
parent02 = high_happiness.pop()
parents.append((parent01.uid, parent02.uid))
parent01.happiness = 2.0
parent02.happiness = 2.0

return parents

Expand Down Expand Up @@ -384,9 +388,9 @@ def make_decision(self):
if dec["name"] == name:
t = dec["count"]

happiness = pow(ent, t) * ((pow(att, w_att))+(pow(hum, w_hum))+(pow(enj, w_enj)) +
happiness = .5 * (pow(ent, t) + ((pow(att, w_att))+(pow(hum, w_hum))+(pow(enj, w_enj)) +
(pow(exc, w_exc)) + (pow(conf, w_conf))+(pow(cont, w_cont)) -
(pow(vit, w_vit)) - (pow(phy, w_phy)) - (pow(ment, w_ment)))
(pow(vit, w_vit)) - (pow(phy, w_phy)) - (pow(ment, w_ment))))

if happiness > happiness_optimized:
happiness_optimized = happiness
Expand All @@ -413,9 +417,9 @@ def make_decision(self):
ment = choice["values"]["mental_energy"]
ent = choice["values"]["entertainment"]

happiness_optimized = pow(ent, t)*((pow(att, w_att)) + (pow(hum, w_hum)) + (pow(enj, w_enj)) +
happiness_optimized = .5 * (pow(ent, t)+((pow(att, w_att)) + (pow(hum, w_hum)) + (pow(enj, w_enj)) +
(pow(exc, w_exc)) + (pow(conf, w_conf)) + (pow(cont, w_cont)) -
(pow(vit, w_vit)) - (pow(phy, w_phy)) - (pow(ment, w_ment)))
(pow(vit, w_vit)) - (pow(phy, w_phy)) - (pow(ment, w_ment))))

self.known_decisions.append({"name": choice["name"], "count": 0})
choice_index = len(self.known_decisions) - 1
Expand All @@ -437,3 +441,4 @@ def make_decision(self):
print("Happiness increased by: " + str(happiness_optimized))
print("Times chosen: " + str(self.known_decisions[choice_index]["count"]))
print("---------------------------------------------")
print(str(self.name) + "'s Happiness: " + str(self.happiness))
Original file line number Diff line number Diff line change
@@ -1,38 +1,47 @@
{
"uid": "0xd403",
"name": "Landen",
"uid": "0x10404",
"name": "Jaidyn",
"dna": [
1,
0,
0,
1,
0,
0,
1,
1,
1,
0,
1,
0,
1,
1,
0,
0,
1,
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
0,
0,
1,
1,
0,
0,
Expand All @@ -42,31 +51,27 @@
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
1,
1,
0,
0,
1,
0,
0,
1,
1,
0,
1,
0,
1,
0,
1,
1,
0,
0,
1,
1,
1,
0,
0,
1,
1,
Expand All @@ -75,24 +80,21 @@
0,
0,
0,
1,
1,
0,
0,
1,
0,
1,
1,
1,
0,
0,
1,
0,
1,
1,
0,
0,
1,
1,
0,
0,
1,
1,
1,
0,
Expand All @@ -101,49 +103,47 @@
1,
1,
0,
0,
1,
0,
0,
1,
0,
1,
1,
0,
0,
1,
1,
0,
0,
0,
1,
0,
1,
1,
0,
0,
0,
1,
0,
1,
0,
1,
0,
0,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0
],
"color": "Purple",
"personality": "ENFJ",
"personality": "ISTJ",
"parents": [
null,
null
],
"happiness": 3.5538269738558705,
"happiness": 4.9400687759036614,
"known_decisions": [
{
"name": "nothing",
Expand Down
Loading

0 comments on commit f757f85

Please sign in to comment.