-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjavaDoc.html
618 lines (540 loc) · 19.6 KB
/
javaDoc.html
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.8.0_51) on Wed Oct 28 09:43:49 EDT 2015 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
MyAgent
</TITLE>
<META NAME="date" CONTENT="2015-10-28">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="MyAgent";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
Class MyAgent</H2>
<PRE>
java.lang.Object
<IMG SRC="./resources/inherit.gif" ALT="extended by ">Agent
<IMG SRC="./resources/inherit.gif" ALT="extended by "><B>MyAgent</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>MyAgent</B><DT>extends Agent</DL>
</PRE>
<P>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#centerColumnIndex">centerColumnIndex</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#totalColumns">totalColumns</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#totalRows">totalRows</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_Agent"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class Agent</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>iAmRed, myGame</CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="MyAgent.html#MyAgent(Connect4Game, boolean)">MyAgent</A></B>(Connect4Game game,
boolean iAmRed)</CODE>
<BR>
Constructs a new MyAgent object, essentially a data structure with access to various functions
to analyze a two-dimensional array for efficient moves to attack and defend
against another AI opponent.</br>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#canWin(boolean)">canWin</A></B>(boolean isRed)</CODE>
<BR>
Returns the column that would allow a winning move</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#diagCheck(boolean)">diagCheck</A></B>(boolean isRed)</CODE>
<BR>
Returns index of the column which can Connect4 diagonally</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#getLowestEmptyIndex(Connect4Column)">getLowestEmptyIndex</A></B>(Connect4Column column)</CODE>
<BR>
Returns the index of the top empty slot in a particular column.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#getName()">getName</A></B>()</CODE>
<BR>
Returns the name of this agent.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> Connect4Slot</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#getSlot(int, int)">getSlot</A></B>(int x,
int y)</CODE>
<BR>
Returns a Connect4Slot of row x column y</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#greaterNegDiagCheck(boolean)">greaterNegDiagCheck</A></B>(boolean isRed)</CODE>
<BR>
Returns the column index which can Connect4 a subset of negative diagonals (scanning top to bottom, left to right)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#greaterPosDiagCheck(boolean)">greaterPosDiagCheck</A></B>(boolean isRed)</CODE>
<BR>
Returns the column index which can Connect4 a subset of positive diagonals (scanning top to bottom, right to left)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#horizCheck(boolean)">horizCheck</A></B>(boolean isRed)</CODE>
<BR>
Returns index of the column in danger of a horizontal Connect Four (three consecutive tokens of opponent's color in the same row)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#iCanWin()">iCanWin</A></B>()</CODE>
<BR>
Returns the column that would allow the agent to win.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#lesserNegDiagCheck(boolean)">lesserNegDiagCheck</A></B>(boolean isRed)</CODE>
<BR>
Returns the column index which can Connect4 a subset of negative diagonals (scanning top to bottom, left to right)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#lesserPosDiagCheck(boolean)">lesserPosDiagCheck</A></B>(boolean isRed)</CODE>
<BR>
Returns the column index which can Connect4 a subset of positive diagonals (scanning top to bottom, right to left)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#move()">move</A></B>()</CODE>
<BR>
The move method is run every time it is this agent's turn in the game.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#moveOnColumn(int)">moveOnColumn</A></B>(int columnNumber)</CODE>
<BR>
Drops a token into a particular column so that it will fall to the bottom of the column.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#negativeDiagCheck(boolean)">negativeDiagCheck</A></B>(boolean isRed)</CODE>
<BR>
Returns the column index which can Connect4 a negative sloping diagonal</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#positiveDiagCheck(boolean)">positiveDiagCheck</A></B>(boolean isRed)</CODE>
<BR>
Returns the column index which can Connect4 a positive sloping diagonal</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#randomMove()">randomMove</A></B>()</CODE>
<BR>
Returns a random valid move.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="MyAgent.html#vertCheck(boolean)">vertCheck</A></B>(boolean isRed)</CODE>
<BR>
Returns index of the column in danger of a vertical Connect Four (three consecutive tokens of opponent's color in the same column)</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_Agent"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class Agent</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>toString</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="centerColumnIndex"><!-- --></A><H3>
centerColumnIndex</H3>
<PRE>
static int <B>centerColumnIndex</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="totalColumns"><!-- --></A><H3>
totalColumns</H3>
<PRE>
static int <B>totalColumns</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="totalRows"><!-- --></A><H3>
totalRows</H3>
<PRE>
static int <B>totalRows</B></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="MyAgent(Connect4Game, boolean)"><!-- --></A><H3>
MyAgent</H3>
<PRE>
public <B>MyAgent</B>(Connect4Game game,
boolean iAmRed)</PRE>
<DL>
<DD>Constructs a new agent, giving it the game and telling it whether it is Red or Yellow.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>game</CODE> - The game the agent will be playing.<DD><CODE>iAmRed</CODE> - True if the agent is Red, False if the agent is Yellow.</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="canWin(boolean)"><!-- --></A><H3>
canWin</H3>
<PRE>
public int <B>canWin</B>(boolean isRed)</PRE>
<DL>
<DD>Returns the column that would allow a winning move
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the index of the winning column</DL>
</DD>
</DL>
<HR>
<A NAME="diagCheck(boolean)"><!-- --></A><H3>
diagCheck</H3>
<PRE>
public int <B>diagCheck</B>(boolean isRed)</PRE>
<DL>
<DD>Returns index of the column which can Connect4 diagonally
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the index of a playable column to block opponent's Connect Four, -1 if no such column exists.</DL>
</DD>
</DL>
<HR>
<A NAME="getLowestEmptyIndex(Connect4Column)"><!-- --></A><H3>
getLowestEmptyIndex</H3>
<PRE>
public int <B>getLowestEmptyIndex</B>(Connect4Column column)</PRE>
<DL>
<DD>Returns the index of the top empty slot in a particular column.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>column</CODE> - The column to check.
<DT><B>Returns:</B><DD>the index of the top empty slot in a particular column; -1 if the column is already full.</DL>
</DD>
</DL>
<HR>
<A NAME="getName()"><!-- --></A><H3>
getName</H3>
<PRE>
public java.lang.String <B>getName</B>()</PRE>
<DL>
<DD>Returns the name of this agent.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE>getName</CODE> in class <CODE>Agent</CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the agent's name</DL>
</DD>
</DL>
<HR>
<A NAME="getSlot(int, int)"><!-- --></A><H3>
getSlot</H3>
<PRE>
public Connect4Slot <B>getSlot</B>(int x,
int y)</PRE>
<DL>
<DD>Returns a Connect4Slot of row x column y
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - - the row index<DD><CODE>y</CODE> - - the column index
<DT><B>Returns:</B><DD>a Connect4Slot object</DL>
</DD>
</DL>
<HR>
<A NAME="greaterNegDiagCheck(boolean)"><!-- --></A><H3>
greaterNegDiagCheck</H3>
<PRE>
public int <B>greaterNegDiagCheck</B>(boolean isRed)</PRE>
<DL>
<DD>Returns the column index which can Connect4 a subset of negative diagonals (scanning top to bottom, left to right)
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the index of diagonal Connect Four column</DL>
</DD>
</DL>
<HR>
<A NAME="greaterPosDiagCheck(boolean)"><!-- --></A><H3>
greaterPosDiagCheck</H3>
<PRE>
public int <B>greaterPosDiagCheck</B>(boolean isRed)</PRE>
<DL>
<DD>Returns the column index which can Connect4 a subset of positive diagonals (scanning top to bottom, right to left)
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the index of diagonal Connect Four column</DL>
</DD>
</DL>
<HR>
<A NAME="horizCheck(boolean)"><!-- --></A><H3>
horizCheck</H3>
<PRE>
public int <B>horizCheck</B>(boolean isRed)</PRE>
<DL>
<DD>Returns index of the column in danger of a horizontal Connect Four (three consecutive tokens of opponent's color in the same row)
<P>
<DD><DL>
<DT><B>Returns:</B><DD>index- if an opponent's horizontal Connect Four can be blocked returns column index, -1 otherwise</DL>
</DD>
</DL>
<HR>
<A NAME="iCanWin()"><!-- --></A><H3>
iCanWin</H3>
<PRE>
public int <B>iCanWin</B>()</PRE>
<DL>
<DD>Returns the column that would allow the agent to win.
You might want your agent to check to see if it has a winning move available to it so that
it can go ahead and make that move. Implement this method to return what column would
allow the agent to win.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the column that would allow the agent to win.</DL>
</DD>
</DL>
<HR>
<A NAME="lesserNegDiagCheck(boolean)"><!-- --></A><H3>
lesserNegDiagCheck</H3>
<PRE>
public int <B>lesserNegDiagCheck</B>(boolean isRed)</PRE>
<DL>
<DD>Returns the column index which can Connect4 a subset of negative diagonals (scanning top to bottom, left to right)
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the index of diagonal Connect Four column</DL>
</DD>
</DL>
<HR>
<A NAME="lesserPosDiagCheck(boolean)"><!-- --></A><H3>
lesserPosDiagCheck</H3>
<PRE>
public int <B>lesserPosDiagCheck</B>(boolean isRed)</PRE>
<DL>
<DD>Returns the column index which can Connect4 a subset of positive diagonals (scanning top to bottom, right to left)
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the index of diagonal Connect Four column</DL>
</DD>
</DL>
<HR>
<A NAME="move()"><!-- --></A><H3>
move</H3>
<PRE>
public void <B>move</B>()</PRE>
<DL>
<DD>The move method is run every time it is this agent's turn in the game. You may assume that
when move() is called, the game has at least one open slot for a token, and the game has not
already been won.
By the end of the move method, the agent should have placed one token into the game at some
point.
After the move() method is called, the game engine will check to make sure the move was
valid. A move might be invalid if:
- No token was place into the game.
- More than one token was placed into the game.
- A previous token was removed from the game.
- The color of a previous token was changed.
- There are empty spaces below where the token was placed.
If an invalid move is made, the game engine will announce it and the game will be ended.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE>move</CODE> in class <CODE>Agent</CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="moveOnColumn(int)"><!-- --></A><H3>
moveOnColumn</H3>
<PRE>
public void <B>moveOnColumn</B>(int columnNumber)</PRE>
<DL>
<DD>Drops a token into a particular column so that it will fall to the bottom of the column.
If the column is already full, nothing will change.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>columnNumber</CODE> - The column into which to drop the token.</DL>
</DD>
</DL>
<HR>
<A NAME="negativeDiagCheck(boolean)"><!-- --></A><H3>
negativeDiagCheck</H3>
<PRE>
public int <B>negativeDiagCheck</B>(boolean isRed)</PRE>
<DL>
<DD>Returns the column index which can Connect4 a negative sloping diagonal
<P>
<DD><DL>
<DT><B>Returns:</B><DD>nextMove, an int representing the column index to play</DL>
</DD>
</DL>
<HR>
<A NAME="positiveDiagCheck(boolean)"><!-- --></A><H3>
positiveDiagCheck</H3>
<PRE>
public int <B>positiveDiagCheck</B>(boolean isRed)</PRE>
<DL>
<DD>Returns the column index which can Connect4 a positive sloping diagonal
<P>
<DD><DL>
<DT><B>Returns:</B><DD>nextMove, an int representing the column index to play</DL>
</DD>
</DL>
<HR>
<A NAME="randomMove()"><!-- --></A><H3>
randomMove</H3>
<PRE>
public int <B>randomMove</B>()</PRE>
<DL>
<DD>Returns a random valid move. If your agent doesn't know what to do, making a random move
can allow the game to go on anyway.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>a random valid move.</DL>
</DD>
</DL>
<HR>
<A NAME="vertCheck(boolean)"><!-- --></A><H3>
vertCheck</H3>
<PRE>
public int <B>vertCheck</B>(boolean isRed)</PRE>
<DL>
<DD>Returns index of the column in danger of a vertical Connect Four (three consecutive tokens of opponent's color in the same column)
<P>
<DD><DL>
<DT><B>Returns:</B><DD>index i if opponent can land a winning move by vertical Connect Four, -1 otherwise</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<HR>
</BODY>
</HTML>