-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrain.gd
More file actions
280 lines (221 loc) · 6.73 KB
/
Copy pathbrain.gd
File metadata and controls
280 lines (221 loc) · 6.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
extends Node
signal chat_bubble (actor_id, text)
signal env_change
var chat: ChatText
var actors: Array[Actor]
var first_time := true
const TALK_DESIRE_THRESHOLD = 0.2
func _init(actors_: Array[Actor]):
actors = actors_
func _process(delta):
var compi_desire = chat.actors[ChatText.ACTOR.COMPI].props["desire to talk"]
var human_desire = chat.actors[ChatText.ACTOR.HUMAN].props["desire to talk"]
if compi_desire.current_value > TALK_DESIRE_THRESHOLD:
print("COMPI TALKS")
if first_time:
chat.only_weights(ChatText.ACTOR.COMPI)
var uterance_compi := chat.select_answer(ChatText.ACTOR.COMPI)
prints("ChatText.ACTOR.COMPI", ChatText.ACTOR.COMPI)
prints("uterance_compi", uterance_compi)
for q in chat.quips:
prints(q, chat.quips[q].weight)
compi_talks(uterance_compi)
if human_desire.current_value > TALK_DESIRE_THRESHOLD:
print("HUMAN TALKS")
if first_time:
chat.only_weights(ChatText.ACTOR.HUMAN)
var uterance_human := chat.select_answer(ChatText.ACTOR.HUMAN)
for q in chat.quips:
prints(q, chat.quips[q].weight)
human_talks(uterance_human)
func compi_talks(uterance_compi):
var compi_desire = chat.actors[ChatText.ACTOR.COMPI].props["desire to talk"]
var human_desire = chat.actors[ChatText.ACTOR.HUMAN].props["desire to talk"]
emit_signal("chat_bubble", ChatText.ACTOR.COMPI, tr(uterance_compi))
chat.read_message(uterance_compi, ChatText.ACTOR.HUMAN)
compi_desire.current_value = 0.0
human_desire.current_value = 0.1
func human_talks(uterance_human):
var compi_desire = chat.actors[ChatText.ACTOR.COMPI].props["desire to talk"]
var human_desire = chat.actors[ChatText.ACTOR.HUMAN].props["desire to talk"]
emit_signal("chat_bubble", ChatText.ACTOR.HUMAN, tr(uterance_human))
chat.read_message(uterance_human, ChatText.ACTOR.COMPI)
compi_desire.current_value = 0.1
human_desire.current_value = 0.0
func _ready():
chat = ChatText.new(actors)
# (chat.new("HELLO")
# .topic("greetings")
# .answer("HI!")
# .answer("HI THERE!")
# .answer("WHO ARE YOU?")
# .update(
# func(_quip, me, you):
# me.props["other: likes me"].increase()
# )
# )
#
# (chat.new("HI!")
# .topic("greetings")
# .answer("HELLO")
# .answer("HI THERE!")
# .update(
# func(_quip, actor_me, actor_you):
# actor_me.props["other: likes me"].increase()
# )
# )
#
# (chat.new("HI THERE!")
# .topic("greetings")
# .answer("HELLO")
# .answer("HI!")
# .update(
# func(_quip, me, you):
# me.props["other: likes me"].increase()
# ))
(chat.new("WHO ARE YOU?")
.topic("who are you")
.answer("IM HUMAN")
.answer("IM COMPI")
.update(
func(_quip, actor):
if (actor.props["other: is human"].sample() < 0
and actor.props["other: is robot"].sample() < 0
and actor.props["other: is cactus"].sample() < 0):
return 20
return 0
))
(chat.new("IM HUMAN")
.weight(w_human)
.topic("who are you")
.topic("player")
.update(
func(_quip, me, you):
me.props["other: is human"].value(1)
me.props["other: is robot"].value(0)
me.props["other: is cactus"].value(0)
))
(chat.new("IM COMPI")
.weight(w_compi)
.topic("who are you")
.topic("compicactus")
.update(
func(_quip, me, you):
me.props["other: is human"].value(0)
me.props["other: is robot"].value(1)
me.props["other: is cactus"].value(1)
))
(chat.new("HOW ARE YOU FEELING TODAY")
.topic("feelings")
.topic("today")
.answer("IM FEELING GREAT")
.answer("IM NOT SO GREAT")
.answer("WHO CARES"))
(chat.new("IM FEELING GREAT")
.topic("feelings")
.weight(w_feeling_good)
.update(u_other_feeling_better))
(chat.new("IM NOT SO GREAT")
.topic("feelings")
.weight(w_feeling_bad)
.update(u_other_feeling_worse))
(chat.new("WHO CARES")
.topic("feelings")
.update(
func(_quip, me, you):
me.props["other: likes me"].decrease()
))
(chat.new("I LIKE THE SOFT TOUCH OF THE WIND")
.topic("feelings")
.topic("wind"))
(chat.new("I ENJOY TALKING TO YOU")
.topic("feelings")
.topic("talk"))
(chat.new("IS THERE SOMETHING YOU WANT TO TELL ME?")
.topic("talk"))
(chat.new("YOU DON'T SEEM ALIVE TO ME")
.topic("life"))
(chat.new("LET ME KNOW IF YOU NEED SOMETHING")
.topic("feelings"))
(chat.new("I'LL BE HERE FOREVER")
.topic("feelings"))
(chat.new("ON RAINY DAYS I FEEL IN PEACE")
.topic("feelings"))
(chat.new("EVERYTHING YOU KNOW IS A LIE")
.topic("feelings"))
(chat.new("YOU DON'T KNOW ME")
.topic("feelings"))
(chat.new("I'M WASTING TIME HERE")
.topic("feelings"))
(chat.new("I DON'T WANT TO HAVE TO JUSTIFY MY EXISTENCE TO ANYONE")
.topic("feelings"))
(chat.new("I JUST KNOW IT")
.topic("feelings"))
(chat.new("I LIKE BEING AN ADULT")
.topic("feelings"))
(chat.new("I CAN DO WEREVER I WANT")
.topic("feelings"))
(chat.new("THERE IS A WORLD BEHIND THIS GLASS")
.topic("feelings"))
(chat.new("I WANT TO HEAR AN ENGINE RORAR")
.topic("feelings"))
(chat.new("THAT IS SOMETHING THAT HUMANS DO")
.topic("feelings"))
(chat.new("BE RIGHT BACK")
.topic("feelings"))
(chat.new("WHERE DID YOU GO?")
.topic("feelings"))
(chat.new("IS NOT IMPORTANT")
.topic("feelings"))
(chat.new("IS NOT YOUR BUSSINESS")
.topic("feelings"))
(chat.new("I WANT YOU TO LIKE ME")
.topic("feelings"))
(chat.new("WHOULD YOU RATHER LIVE IN THE PAST OR THE FUTURE")
.topic("feelings"))
(chat.new("I WOULD LOVE TO LIVE IN THE PAST")
.topic("feelings"))
(chat.new("CAN'T WAIT TO LIVE IN THE FUTURE")
.topic("feelings"))
(chat.new("NOTHING IS WHAT USED TO BE")
.topic("feelings"))
(chat.new("I NEED SOME WATER")
.topic("feelings"))
(chat.new("SPIDER WEBS ARE HIPNOTIC")
.topic("feelings"))
(chat.new("OWNING A BUSINESS IS NOT EASY")
.topic("feelings"))
#
(chat.new("ITS NIGHT TIME ALREADY")
.topic("night"))
(chat.new("ITS DARK OUT THERE")
.topic("night"))
(chat.new("ITS DARK OUT THERE")
.topic("night"))
(chat.new("IM NOT A PERSON")
.topic("feelings")
.update(
func(_quip, me, you):
me.props["other: is human"].value(0)
me.props["other: is robot"].value(1)
))
var w_human = func(_quip, actor) -> int:
if actor.props["I'm human"].sample() > 0.5:
return 10
return -100
var w_compi = func(_quip, actor) -> int:
if actor.props["I'm a cactus"].sample() > 0.5:
return 10
return -100
var w_feeling_good = func(_quip, actor):
return actor.props["feeling good"].sample()*10
var w_feeling_bad = func(_quip, actor):
return actor.props["feeling good"].sample()*-10
var u_other_feeling_better = func(_quip, me, you):
me.props["other: feeling good"].increase()
var u_other_feeling_worse = func(_quip, me, you):
me.props["other: feeling good"].decrease()
var u_other_likes_me = func(_quip, me, you):
me.props["other: likes me"].increase()
var u_like_other = func(_quip, me, you):
me.props["like other"].increase()