Skip to content

Commit

Permalink
update decision_definition function so each pudgi executes a decision…
Browse files Browse the repository at this point in the history
… every 15 seconds (our time)
  • Loading branch information
Kcunningham20 committed Apr 26, 2018
1 parent ecdad23 commit 4b368e2
Show file tree
Hide file tree
Showing 32 changed files with 4,170 additions and 20 deletions.
6 changes: 1 addition & 5 deletions virtupet/.idea/misc.xml

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

2 changes: 1 addition & 1 deletion virtupet/.idea/virtupet.iml

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

9 changes: 8 additions & 1 deletion virtupet/Pudgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def make_decision(self):
w_phy = self.weights["physical"]
w_ment = self.weights["mental"]

if random.random() > 1.0:
if random.random() > 0.5:
index = 0
for decision in self.known_decisions:
name = decision["name"]
Expand Down Expand Up @@ -430,3 +430,10 @@ def make_decision(self):
self.happiness = 10

self.known_decisions[choice_index]["count"] += 1

print("---------------------------------------------")
print("Pudgi: " + self.name)
print("Choice: " + choice["name"])
print("Happiness increased by: " + str(happiness_optimized))
print("Times chosen: " + str(self.known_decisions[choice_index]["count"]))
print("---------------------------------------------")
6 changes: 6 additions & 0 deletions virtupet/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ def time_stamp(self):

def update_time(self):
self.cur_time = int(self.elapsed_time())

def get_minutes(self):
return "%02d" % (datetime.datetime.now().second, )

def get_seconds(self):
return "%02d" % (datetime.datetime.now().microsecond, )
12 changes: 4 additions & 8 deletions virtupet/data/decisions.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@
"confidence": 0.3,
"contentment": 0.7,
"entertainment": 0.7,
<<<<<<< HEAD
"vitality": 0.1,
"mental_energy": 0.5,
"physical_energy": 0.1,
"vitality": 0.1,
"mental_energy": 0.5,
"physical_energy": 0.1
=======
"vitality": -0.1,
"mental_energy": -0.5,
"physical_energy": -0.1
>>>>>>> aaa86423ec248d32b4e27f160d302ae2ae368651
}
},
{ "name": "eat_veggies", "values":
Expand Down Expand Up @@ -112,5 +109,4 @@
"physical_energy": 0.1
}
}
]
}
]
157 changes: 157 additions & 0 deletions virtupet/data/pudgies/0x10f22.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"uid": "0x10f22",
"name": "Jadyn",
"dna": [
1,
1,
0,
0,
0,
1,
1,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
1,
1,
0,
0,
0,
1,
1,
0,
1,
0,
0,
0,
1,
0,
1,
1,
1,
0,
0,
1,
1,
0,
0,
1,
0,
0,
1,
0,
0,
0,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
0,
0,
1,
1,
0,
0,
0,
1,
1,
1,
1,
1,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
1,
0,
0,
1,
1,
1,
0,
1,
1,
1,
0,
1,
1,
0,
0,
0
],
"color": "Vampire",
"personality": "ESFP",
"parents": [
null,
null
],
"happiness": 6.283615629740961,
"known_decisions": [
{
"name": "nothing",
"count": 1
},
{
"name": "reading",
"count": 1
}
]
}
153 changes: 153 additions & 0 deletions virtupet/data/pudgies/0x11dbe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"uid": "0x11dbe",
"name": "Devyn",
"dna": [
0,
0,
0,
1,
0,
0,
1,
1,
1,
0,
0,
1,
0,
1,
0,
1,
0,
0,
1,
1,
1,
0,
1,
1,
0,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
1,
0,
1,
0,
0,
0,
0,
1,
0,
1,
0,
1,
1,
0,
1,
0,
0,
1,
0,
1,
1,
1,
0,
0,
1,
1,
0,
0,
0,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
0,
1,
0,
0,
0,
1,
1,
1,
1,
0,
1,
0,
0,
1,
0,
0,
1,
1,
0,
0,
1,
1,
0,
0,
0,
1,
0,
0,
0,
0
],
"color": "Vampire",
"personality": "ESFP",
"parents": [
null,
null
],
"happiness": 3.2392281679259907,
"known_decisions": [
{
"name": "nothing",
"count": 1
}
]
}
Loading

0 comments on commit 4b368e2

Please sign in to comment.