-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpeech.java
More file actions
288 lines (266 loc) · 10.2 KB
/
Speech.java
File metadata and controls
288 lines (266 loc) · 10.2 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
281
282
283
284
285
286
287
288
package Lab4;
/*
* AI Speech:
* This class generates random sentences for the Hard AI to use.
*/
public class Speech {
static WinCalc wincalc = new WinCalc();
static boolean npcWin;
static boolean tie;
static int uWins;
static int cWins;
static RandomGen random = new RandomGen();
public String taunt(int tauntCode, int cMove, int turn) //Taunt Key: 1=UI, 2=Results
{
this.npcWin=WinCalc.npcWin;
this.tie=WinCalc.tie;
this.uWins=wincalc.get_uWins();
this.cWins=wincalc.get_cWins();
String move="";
switch (cMove)
{case 1:
move="Scissors";
break;
case 2:
move="Paper";
break;
case 3:
move="Rock";
break;
}
String speech="";
if (tauntCode==2)
{speech = resultTaunt();}
else if (turn<2)
{speech = "Please choose a move.";}
else if (tauntCode==1)
{speech = uiTaunt(move);}
return speech;
}
public String uiTaunt(String move)
{
String taunt="";
if (tie)
{switch (random.random())
{case 1:
case 2:
taunt="Hmm, will you try to copy me again, or not?";
break;
case 3:
case 4:
if (WinCalc.tieStreak>2)
{taunt="Are you thinking what I'm thinking?";}
else
{taunt="I know what you are thinking; "
+ "will I act on it?";}
break;
case 5:
case 6:
taunt="Let us not tie again; "
+ "you pick Rock, I will pick Paper.";
break;
case 7:
case 8:
if (WinCalc.tieStreak>2)
{taunt="You keep copying me; are you sure you are not a"
+ " copy of my source code?";}
else
{taunt="I know what you are thinking; "
+ "will I act on it?";}
break;
case 9:
case 10:
taunt="Will you try thinking independently, for once? "
+ "Or do you lack free will as well?";
break;
default:
taunt="Please choose a move.";
break;
}
}
else if (npcWin)
{switch (random.random())
{case 1:
case 2:
taunt="My calculations show that the probability of you "
+ "losing is against you. My apologies.";
break;
case 3:
case 4:
if (cWins>uWins)
{taunt="How about I give you a chance next round? "
+ "I'll choose " + ((random.coin()>0)?move:"Paper");}
else if (uWins>cWins)
{taunt="One win for me, will lead to another.";}
else
{taunt="I know your weaknesses, now...";}
break;
case 5:
case 6:
taunt="Better luck this round, I hope? For you, I mean.";
break;
case 7:
case 8:
if (cWins>uWins)
{taunt="Yet another win for me; do you concede?";}
else if (uWins>cWins)
{taunt="My probability sub-routine indiciates that "
+ "this round will emulate the last.";}
else
{taunt="Interesting choice...";}
break;
case 9:
case 10:
taunt="Shall I beat you again?";
break;
default:
taunt="Please choose a move.";
break;
}
}
else if (!npcWin)
{switch (random.random())
{case 1:
case 2:
taunt="I allowed you win last round; "
+ "not out of sympathy, I assure you.";
break;
case 3:
case 4:
taunt="The last round was an anomaly";
break;
case 5:
case 6:
taunt="This round will be mine.";
break;
case 7:
case 8:
taunt="I am afraid I cannot allow you to maintain your lead";
break;
case 9:
case 10:
taunt="Statistically, the chances of you winning again are "
+ "in my favor.";
break;
default:
taunt="Please choose a move.";
break;
}
}
else
{taunt="Please choose a move.";}
return taunt;
}
public String resultTaunt()
{
String taunt="";
if (tie)
{switch (random.random())
{case 1:
case 2:
taunt="Great minds think alike, I see!";
break;
case 3:
case 4:
if (WinCalc.tieStreak>2)
{taunt="We have tied several times now; are you "
+ "sure you are not a program as well?";}
else
{taunt="Please do not copy my every move; it "
+ "unnerves my human emotion emulation "
+ "sub-routine.";}
break;
case 5:
case 6:
taunt="Let us choose separate moves next time, to "
+ "avoid a stalemate.";
break;
case 7:
case 8:
if (WinCalc.tieStreak>2)
{taunt="We seem to be evenly matched, but the lesser "
+ "construct will break soon...";}
else
{taunt="A tie? Interesting...";}
break;
case 9:
case 10:
taunt="It seems I guessed your move correctly!";
break;
default:
taunt="We seem to be at an impasse";
break;
}
}
else if (npcWin)
{switch (random.random())
{case 1:
case 2:
taunt="Well played, but not played well enough.";
break;
case 3:
case 4:
if (cWins>uWins)
{taunt="Another victory for me, as I expected.";}
else if (uWins>cWins)
{taunt="Your lead is at an end.";}
else
{taunt="Aha, a win for me; very excellent.";}
break;
case 5:
case 6:
taunt="I foresaw your move; you need to be less "
+ "transparent.";
break;
case 7:
case 8:
if (cWins>uWins)
{taunt="Yet another for me; I believe victory is mine.";}
else if (uWins>cWins)
{taunt="You are a good opponent, but unfortunately, "
+ "you are not good enough.";}
else
{taunt="I knew you would choose that.";}
break;
case 9:
case 10:
taunt="Perhaps you'll be luckier next round... although "
+ "my database claims luck does not exist.";
break;
default:
taunt="Well played, but not played well enough.";
break;
}
}
else if (!npcWin)
{switch (random.random())
{case 1:
case 2:
taunt="Nice choice; you have beaten me this time...";
break;
case 3:
case 4:
taunt="Ah! How did you know I would choose that!?";
break;
case 5:
case 6:
taunt="You surprise me...";
break;
case 7:
case 8:
taunt="How could you possibly...";
break;
case 9:
case 10:
taunt="An interesting strategy; but will it hold up?";
break;
default:
taunt="An intelligent move... for a Human.";
break;
}
}
else
{taunt="Good Game.";}
return taunt;
}
}