-
Notifications
You must be signed in to change notification settings - Fork 0
/
four_in_a_row.html
900 lines (792 loc) · 33.1 KB
/
four_in_a_row.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
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
<!doctype html>
<html>
<head>
<style>[ng-cloak] { display: none; }
#header_title {
/*position: absolute;*/
top: -120px;
width: 100%;
font-size: 70px;
font-weight: bold;
text-align: center;
color: #b3b3b3;
color: rgba(255, 255, 255, 0.3);
text-shadow: -1px -1px rgba(0, 0, 0, 0.2);
-webkit-text-rendering: optimizeLegibility;
-moz-text-rendering: optimizeLegibility;
-ms-text-rendering: optimizeLegibility;
-o-text-rendering: optimizeLegibility;
text-rendering: optimizeLegibility;
}
</style>
<style type="text/css">
img {border: 0}
.bluetext {font-size: 14px; font-family: "Comic Sans MS", Verdana; color: blue; font-weight: bold}
.redtext {font-size: 14px; font-family: "Comic Sans MS", Verdana; color: red; font-weight: bold}
.blacktext { font-size: 14px; font-family: "Comic Sans MS", Verdana; color: #000000; font-weight: bold }
</style>
<script language="JavaScript" type="text/javascript">
<!-- Begin
// Note when upgrading template, remember to add onload="AutoStart();" to BODY statement
var FIRSTIMAGE = 0;
var ROWS = 6;
var COLS = 7;
var WINVAL = 100000;
var theAnim = new Animation();
var moves = 0;
var gameActive = 0;
var isdropping = 0;
var RedNum=1;
var BlkNum=2;
var debugstr;
var whosFirst;
var matchMade = 0;
var lookForSrc;
var redScore = 0;
var bluScore = 0;
var colcount = new Array(COLS);
var board = new Array(ROWS);
for (var row = 0; row < ROWS; row++) {
board[row] = new Array(COLS);
for (var col=0; col < COLS; col++) {
board[row][col] = 0;
}
}
var linecount = 0;
var linecoords = new Array(70);
fill_lines();
function fill_lines() {
for(row = 0; row<ROWS; row++) {
for(col = 0; col<COLS; col++) {
for(rowchg = -1; rowchg <= 1; rowchg++) {
for(colchg = -1; colchg <= 1; colchg++) {
if(
(
((rowchg == 1) && (colchg == 0)) ||
((rowchg == 1) && (colchg == 1)) ||
((rowchg == 0) && (colchg == 1)) ||
((rowchg == -1) && (colchg == 1))
) &&
(inbounds( row + (1*rowchg), col + (1*colchg) )) &&
(inbounds( row + (2*rowchg), col + (2*colchg) )) &&
(inbounds( row + (3*rowchg), col + (3*colchg) ))
) {
linecoords[linecount] = new Array(5);
linecoords[linecount][0] = row;
linecoords[linecount][1] = col;
linecoords[linecount][2] = rowchg;
linecoords[linecount][3] = colchg;
// line weight
if (row==0 && rowchg==0 && colchg==1) {
linecoords[linecount][4]=2;
} else {
linecoords[linecount][4]=1;
}
linecount += 1;
}
}
}
}
}
}
function inbounds(row, col) {
return ((row >= 0) && (col >= 0) && (row < ROWS) && (col < COLS));
}
function rePlay() {
if (gameActive == 1) {
document.formo.redScoreBoard.value = redScore + "";
document.formo.bluScoreBoard.value = bluScore + "";
clearBoard();
}
for (var col=0; col < COLS; col++) {
colcount[col] = 0;
}
for (var row=0; row < ROWS; row++) {
for (var col=0; col < COLS; col++) {
board[row][col] = 0;
}
}
moves = 0;
isdropping = 0;
}
var redSpot = new Image();
var bluSpot = new Image();
var emptySpot = new Image();
var emptyPiece = new Image();
var redPiece = new Image();
var bluPiece = new Image();
redSpot.src = "https://www.mathsisfun.com/games/images/c4fillred.gif";
bluSpot.src = "https://www.mathsisfun.com/games/images/c4fillblu.gif";
emptySpot.src = "https://www.mathsisfun.com/games/images/c4fillempty.gif";
emptyPiece.src = "https://www.mathsisfun.com/games/images/c4clearness.gif";
redPiece.src = "https://www.mathsisfun.com/games/images/c4redpiece.gif";
bluPiece.src = "https://www.mathsisfun.com/games/images/c4blupiece.gif";
var whosTurn = RedNum;
var whosTurnSpot = new Image();
var whosTurnPiece = new Image();
whosTurnSpot.src = redSpot.src;
whosTurnPiece.src = redPiece.src ;
function clearBoard() {
for (var a = 7; a <= 48; a++) {
document.images[FIRSTIMAGE+a].src = emptySpot.src;
}
}
function placeTop(picToPlace) {
if (gameActive == 1) {
document.images[FIRSTIMAGE + picToPlace].src = whosTurnPiece.src;
}
}
function unPlaceTop(picToUnplace) {
if (gameActive == 1) {
document.images[FIRSTIMAGE + picToUnplace].src = emptyPiece.src;
}
}
function dropIt(whichCol) {
moves+=1;
if (gameActive == 1) {
if (isdropping == 0) {
isdropping = 1;
var placeLoc = FIRSTIMAGE + (ROWS - colcount[whichCol]) * COLS + whichCol;
if (colcount[whichCol] < 6) {
theAnim.addFrame( FIRSTIMAGE + whichCol, emptyPiece.src);
for (var i=(ROWS-1); i>colcount[whichCol]; i--) {
tempLoc = FIRSTIMAGE + (ROWS - i) * COLS + whichCol
theAnim.addFrame( tempLoc, whosTurnSpot.src);
theAnim.addFrame( tempLoc, emptySpot.src);
}
theAnim.finalcall = "checkForWinner(" + whosTurn + ")";
theAnim.addFrame( placeLoc, whosTurnSpot.src);
//document.images[placeLoc].src = whosTurnSpot.src;
colcount[whichCol] += 1;
if (whosTurn==RedNum) {
board[colcount[whichCol]-1][whichCol] = RedNum;
} else {
board[colcount[whichCol]-1][whichCol] = BlkNum;
}
//checkForWinner(whosTurn);
//placeTop(whichRow);
}
}
}
}
function boarddump() {
s = "";
for(var col = 0; col<COLS; col++) {
s += "Col " + col + "=" + colcount[col] + " -> ";
for(var row = 0; row<ROWS; row++) {
s += board[row][col] + ",";
}
s += ";\n";
}
return s;
}
function whoGoesFirst() {
whosTurn = whosFirst;
switchTurns();
if (whosFirst == RedNum) {
whosFirst = BlkNum;
} else {
whosFirst = RedNum;
}
}
function switchTurns() {
if (gameActive == 1) {
if (whosTurn == RedNum) {
whosTurn = BlkNum;
whosTurnSpot.src = bluSpot.src;
whosTurnPiece.src = bluPiece.src;
document.formo.texter.value = document.formo.blkplayer.value + "'s turn.";
} else {
whosTurn = RedNum;
whosTurnSpot.src = redSpot.src;
whosTurnPiece.src = redPiece.src;
document.formo.texter.value = document.formo.redplayer.value + "'s turn.";
}
if (whosTurn==RedNum && document.formo.redtype.value=="Computer") ComputersTurn(RedNum);
if (whosTurn==BlkNum && document.formo.blktype.value=="Computer") ComputersTurn(BlkNum);
isdropping = 0;
}
}
function ComputersTurn(player) {
setTimeout("AComputersTurn("+player+")", 1);
}
function AComputersTurn(player) {
//debug("Levels=" + Levels + "," + StupidProb + "," + Difficulty );
Levels = 9;
MyNum=player;
if(MyNum==RedNum){
YourNum=BlkNum;
}else{
YourNum=RedNum;
}
//hardCoding
if(moves==0){
BestCol=1;
}
else if(moves==1){
//after turn
if(board[0][0]!=0){
BestCol=1;
}else if(board[0][1]!=0){
BestCol=2;
}else if(board[0][2]!=0){
BestCol=3;
}else if(board[0][3]!=0){
BestCol=3;
}else if(board[0][4]!=0){
BestCol=3;
}else if(board[0][5]!=0){
BestCol=4;
}else{
BestCol=5;
}
}else if(moves==2){
if(board[0][1]==MyNum&&board[0][0]==YourNum){
BestCol=1;
}else if(board[0][1]==MyNum&&board[1][1]==YourNum){
BestCol=4;
}else if(board[0][1]==MyNum&&board[0][2]==YourNum){
BestCol=1;
}else if(board[0][1]==MyNum&&board[0][3]==YourNum){
BestCol=3;
}else if(board[0][1]==MyNum&&board[0][6]==YourNum){
BestCol=1;
}else{
BestCol = MaxMove(player, Levels, Number.MAX_VALUE, "Col");
}
}else if (moves==3){
if(board[0][5]==YourNum&&board[0][4]==MyNum&&board[1][4]==YourNum){
BestCol=4;
}else{
BestCol = MaxMove(player, Levels, Number.MAX_VALUE, "Col");
}
}
else if(moves==5){
if(board[0][1]==YourNum&&board[0][2]==MyNum&&board[1][1]==YourNum&&board[2][1]==MyNum&&board[3][1]==YourNum){
BestCol=2;
}else {
BestCol = MaxMove(player, Levels, Number.MAX_VALUE, "Col");
}
}else if(moves==7){
if(board[0][1]==YourNum&&board[0][2]==MyNum&&board[1][1]==YourNum&&board[2][1]==MyNum&&board[3][1]==YourNum&&board[1][2]==MyNum&&board[2][2]==YourNum){
BestCol=2;
}else{
BestCol = MaxMove(player, Levels, Number.MAX_VALUE, "Col");
}
}
else {//MaxMove(BlkNum, 8, Number.MAX_VALUE, "Col");
BestCol = MaxMove(player, Levels, Number.MAX_VALUE, "Col");
}
dropIt(BestCol);
}
function freerow(col) {
var x=-1;
for(var row=0; row<ROWS; row++) {
if (board[row][col]==0) { // found where to put the Piece
x=row;
break;
}
}
return(x);
}
function MaxMove (player, level, ParentMin, want) {
if (level <=0) { // NB or game ended
return GetBoardVal(player);
} else {
var MaxCol = 0;
var MaxVal = -WINVAL*10;
for(var col = 0; col<COLS; col++) {
var row = freerow(col);
if (row>=0) {
board[row][col] = player;//MinMove(RedNum, 7, -WINVAL*10, "Val");
var TheVal = MinMove(player, level-1, MaxVal, "Val");
board[row][col]=0; // undo move
if (TheVal == WINVAL) return WINVAL; // game won
if(TheVal > ParentMin) {// no need to go further, because the max will be greater than the min already found
return TheVal;
} else {
if (TheVal > MaxVal ) {
MaxVal = TheVal ;
MaxCol = col;
}
}
}
}
//debug( "Max -> MaxVal=" + MaxVal + ", MaxCol=" + MaxCol + "\n" );
if (want=="Val") {
return MaxVal;
} else {
return MaxCol;
}
}
}
function MinMove (player, level, ParentMax, want) {
if (level <=0) { // NB or game ended
return GetBoardVal(player);
} else {
var MinCol = 0;
var MinVal = WINVAL*10;
for(var col = 0; col<COLS; col++) {
var row = freerow(col);
if (row>=0) {
if (player==RedNum) { // do move with OPPOSITE player
board[row][col] = BlkNum;
} else {
board[row][col] = RedNum;
}
var TheVal = MaxMove(player, level-1, MinVal, "Val");
board[row][col]=0; // undo move
if (TheVal == -WINVAL) return -WINVAL; // game won by opponent
if(TheVal < ParentMax) {// no need to go further, because the min will be less than the max already found
return TheVal;
} else {
if (TheVal < MinVal ) { // less than
MinVal = TheVal;
MinCol = col;
}
}
}
}
//debug( "Min -> MinVal=" + MinVal + ", MinCol=" + MinCol + "\n" );
return MinVal;
}
}
function GetBoardVal(player) {
thesum = 0;
for(var rowno=0; rowno<linecount; rowno++) {
var theline = linecoords[rowno];
thesum += Strength(player,theline[0],theline[1],theline[2],theline[3]) * theline[4];
}
return thesum;
}
function Strength(player, row, col, rowchg, colchg) {
if (player==BlkNum) {
player2 = RedNum;
} else {
player2 = BlkNum;
}
MeInARow = 0;
MeMaxInARow = 0;
YouInARow = 0;
YouMaxInARow = 0;
for(pos=0; pos<4; pos++) {
posplayer = board[row+pos*rowchg][col+pos*colchg];
if (posplayer==player) {
MeInARow += 1;
if (MeInARow>MeMaxInARow) MeMaxInARow=MeInARow;
} else {
MeInARow = 0;
}
if (posplayer==player2) {
YouInARow += 1;
if (YouInARow>YouMaxInARow) YouMaxInARow=YouInARow;
} else {
YouInARow = 0;
}
}
x = 0;
if (MeMaxInARow==1) x += 1;
if (MeMaxInARow==2) {
x += 4;
}
if (MeMaxInARow==3) {
x += 64*4 - YouMaxInARow*16*4;
}
if (MeMaxInARow==4) x = 10*WINVAL;
if (YouMaxInARow==1) x -= 1;
if (YouMaxInARow==2) {
x -= 4;
}
if (YouMaxInARow==3) {
x -= (64*4 - MeMaxInARow*16*4);
}
if (YouMaxInARow==4) x = -10*WINVAL;
return x;
}
function AutoStart() {
gameActive = 1;
rePlay();
redScore = 0;
bluScore = 0;
document.formo.redScoreBoard.value = redScore + "";
document.formo.bluScoreBoard.value = bluScore + "";
matchMade = 1;
bluIsComputer = 1;
whosFirst = RedNum;
if (whosFirst == RedNum) {
document.formo.texter.value = document.formo.redplayer.value + "'s turn.";
whosTurn = BlkNum;
switchTurns();
whosFirst = RedNum;
} else {
document.formo.texter.value = document.formo.blkplayer.value + "'s turn.";
whosTurn = RedNum;
switchTurns();
whosFirst = BlkNum;
}
}
function checkForWinner(player) {
if (gameActive == 1) {
var someOneWon;
someOneWon = 0;
if (player == RedNum) {
lookForSrc = redSpot.src;
}
if (player == BlkNum) {
lookForSrc = bluSpot.src;
}
for (var ic = 7; ic <= 48; ic++) {
if (document.images[FIRSTIMAGE + ic].src == lookForSrc) {
if ((ic + 3 <= 48
&& ic != 11 && ic != 12 && ic != 13
&& ic != 18 && ic != 19 && ic != 20
&& ic != 25 && ic != 26 && ic != 27
&& ic != 32 && ic != 33 && ic != 34
&& ic != 39 && ic != 40 && ic != 41
&& document.images[FIRSTIMAGE + ic + 1].src == lookForSrc
&& document.images[FIRSTIMAGE + ic + 2].src == lookForSrc
&& document.images[FIRSTIMAGE + ic + 3].src == lookForSrc)
|| (ic + 3 * 7 <= 48
&& document.images[FIRSTIMAGE + ic + 7].src == lookForSrc
&& document.images[FIRSTIMAGE + ic + 7*2].src == lookForSrc
&& document.images[FIRSTIMAGE + ic + 7*3].src == lookForSrc)
|| (ic + 3 * 7 <= 48
&& ic != 11 && ic != 12 && ic != 13
&& ic != 18 && ic != 19 && ic != 20
&& ic != 25 && ic != 26 && ic != 27
&& document.images[FIRSTIMAGE + ic + 7 + 1].src == lookForSrc
&& document.images[FIRSTIMAGE + ic + 7*2 + 2].src == lookForSrc
&& document.images[FIRSTIMAGE + ic + 7*3 + 3].src == lookForSrc)
|| (ic - 3 * 7 >= 7
&& ic != 32 && ic != 33 && ic != 34
&& ic != 39 && ic != 40 && ic != 41
&& ic != 46 && ic != 47 && ic != 48
&& document.images[FIRSTIMAGE + ic - 7 + 1].src == lookForSrc
&& document.images[FIRSTIMAGE + ic - 7*2 + 2].src == lookForSrc
&& document.images[FIRSTIMAGE + ic - 7*3 + 3].src == lookForSrc)) {
for (var col=0; col<COLS; col++) {
unPlaceTop(col);
}
if (player == RedNum) {
alert(document.formo.redplayer.value + " wins.");
redScore += 1;
} else if (player == BlkNum) {
alert(document.formo.blkplayer.value + " wins.");
bluScore += 1;
}
gameActive = 0;
someOneWon = 1;
ic = 49;
document.formo.redScoreBoard.value = redScore + "";
document.formo.bluScoreBoard.value = bluScore + "";
}
}
}
if (someOneWon != 1) {
colsFull = 0;
for (var col=0; col<COLS; col++) {
if (colcount[col]==ROWS) {
colsFull += 1;
}
}
if (colsFull==COLS) {
for (var col = 0; col<COLS; col++) {
unPlaceTop(col);
}
gameActive = 0;
alert("This game has reached a draw.");
debug("end");
}
}
// NB these go here, coz the last animation frame calls "CheckForWinner" and then has to do these:
switchTurns();
isdropping = 0;
//placeTop(1); // NB
//for (var col=0; col<COLS; col++) {
// unPlaceTop(col);
//}
}
}
function newGame() {
if (matchMade == 1) {
debug("stt");
gameActive = 1;
isdropping = 0;
moves=0;
rePlay();
whoGoesFirst();
}
}
function newMatchUp() {
if (confirm("Are you sure you want to Start a new match?")) {
gameActive = 1;
isdropping = 0;
rePlay();
redScore = 0;
bluScore = 0;
document.formo.redScoreBoard.value = redScore + "";
document.formo.bluScoreBoard.value = bluScore + "";
matchMade = 1;
whoGoesFirst();
}
}
function setMsg(whatToSay) {
window.status = whatToSay;
return true;
}
function debugend() {
debug("end");
}
function debug(thestr) {
if (thestr=="stt") {
debugstr ="";
timestt = new Date();
} else {
if (thestr=="end") {
timeend = new Date();
//debugstr += "\n[" + (timeend.getTime() - timestt.getTime()) + "ms]";
document.formo.comments.value = debugstr;
} else {
debugstr += thestr;
}
}
}
//
// Animation functions
//
// The Animation Object constructor
function Animation() {
this.imageNum = new Array(); // Array of indicies document.images to be changed
this.imageSrc = new Array(); // Array of new srcs for imageNum array
this.frameIndex = 0; // the frame to play next
this.alreadyPlaying = false; // semaphore to ensure we play smoothly
this.finalcall = ""; // what to call when animation finished
// Methods
this.getFrameCount = getframecount; // the total number of frames so far
this.moreFrames = moreframes; // tells us if there are more frames to play
this.addFrame = addframe; // add a frame to the animation
this.drawNextFrame = drawnextframe; // draws the next frame
this.startAnimation = startanimation; // start the animation if necessary
}
function finalcall(FuncToCall) {
this.finalcall = FuncToCall;
}
function getframecount() { return this.imageNum.length; }
function moreframes() { return this.frameIndex < this.getFrameCount(); }
function startanimation() {
if (!this.alreadyPlaying) {
theAnim.alreadyPlaying = true;
setTimeout('theAnim.drawNextFrame()',5);
}
}
function addframe(num, src) {
var theIndex = theAnim.imageNum.length;
theAnim.imageSrc[theIndex] = src;
theAnim.imageNum[theIndex] = num;
theAnim.startAnimation();
}
function drawnextframe() {
if (theAnim.moreFrames()) {
document.images[ theAnim.imageNum[theAnim.frameIndex] ].src = theAnim.imageSrc[theAnim.frameIndex];
theAnim.frameIndex++;
setTimeout('theAnim.drawNextFrame()', 20);
} else {
theAnim.alreadyPlaying = false;
if (this.finalcall.length>0) {
setTimeout(this.finalcall,5);
}
}
}
// End -->
</script>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="https://www.mathsisfun.com/style2.css" />
</head>
<body style="">
<h1 id="header_title">Four In a Rows</h1>
<center>
<form name="formo" id="formo">
<table border="0">
<tr>
<td valign="top" bgcolor="#FFFFCC">
<table border="0">
<tr>
<td width="128"> </td>
<td width="144"> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" name="reStartButton" value="New Game" onClick="newGame()" class="blacktext" />
</td>
</tr>
<tr>
<td width="128"> </td>
<td width="144"> </td>
</tr>
<tr>
<td width="128"></td>
<td width="144"> </td>
</tr>
<tr>
<td align="right" width="128">
<div class="redtext">Red Player is a</div>
</td>
<td width="144">
<select name="redtype">
<option value="Human" selected="selected">Human</option>
<option value="Computer">Computer</option>
</select>
</td>
</tr>
<tr>
<td align="right" width="128">
<div class="redtext">called</div>
</td>
<td width="144">
<input type="text" name="redplayer" value="User" />
</td>
</tr>
<tr>
<td width="128"> </td>
<td width="144"> </td>
</tr>
<tr>
<td align="right" width="128">
<div class="bluetext">Blue Player is a</div>
</td>
<td width="144">
<select name="blktype">
<option value="Human">Human</option>
<option value="Computer" selected="selected">Computer</option>
</select>
</td>
</tr>
<tr>
<td align="right" width="128">
<div class="bluetext">called</div>
</td>
<td width="144">
<input type="text" name="blkplayer" value="Computer" />
</td>
</tr>
<tr>
<td width="128"> </td>
<td width="144"> </td>
</tr>
<tr>
<td width="128">
<div class="blacktext" align="right">Score</div>
</td>
<td width="144">
<table border="0" width="107">
<tr align="center">
<td>
<div class="redtext">Red</div>
</td>
<td> </td>
<td>
<div class="bluetext">Blue</div>
</td>
</tr>
<tr align="center">
<td>
<input type="text" name="redScoreBoard" style="font-size: 16px; font-family: Comic Sans MS, Verdana;" size="3" />
</td>
<td><b>:</b></td>
<td>
<input type="text" name="bluScoreBoard" style="font-size: 16px; font-family: Comic Sans MS, Verdana;" size="3" />
</td>
</tr>
</table>
<input type="button" name="startButton" value="New Match" onClick="newMatchUp()" />
</td>
</tr>
</table>
</td>
<td>
<table border="0" width="271">
<tr>
<td>
<div align="center">
<input type="text" name="texter" style="font-size: 18px; font-family: Comic Sans MS, Verdana;" size="25" />
</div>
</td>
</tr>
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFF99">
<tr>
<td><a href="javascript:void dropIt(0)" onMouseOver="placeTop(0); setMsg(''); return true" onMouseOut="unPlaceTop(0)"><img border="0" src="https://www.mathsisfun.com/games/images/c4clearness.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(1)" onMouseOver="placeTop(1); setMsg(''); return true" onMouseOut="unPlaceTop(1)"><img border="0" src="https://www.mathsisfun.com/games/images/c4clearness.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(2)" onMouseOver="placeTop(2); setMsg(''); return true" onMouseOut="unPlaceTop(2)"><img border="0" src="https://www.mathsisfun.com/games/images/c4clearness.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(3)" onMouseOver="placeTop(3); setMsg(''); return true" onMouseOut="unPlaceTop(3)"><img border="0" src="https://www.mathsisfun.com/games/images/c4clearness.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(4)" onMouseOver="placeTop(4); setMsg(''); return true" onMouseOut="unPlaceTop(4)"><img border="0" src="https://www.mathsisfun.com/games/images/c4clearness.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(5)" onMouseOver="placeTop(5); setMsg(''); return true" onMouseOut="unPlaceTop(5)"><img border="0" src="https://www.mathsisfun.com/games/images/c4clearness.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(6)" onMouseOver="placeTop(6); setMsg(''); return true" onMouseOut="unPlaceTop(6)"><img border="0" src="https://www.mathsisfun.com/games/images/c4clearness.gif" height="50" width="50" /></a></td>
</tr>
<tr>
<td><a href="javascript:void dropIt(0)" onMouseOver="placeTop(0); setMsg(''); return true" onMouseOut="unPlaceTop(0)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(1)" onMouseOver="placeTop(1); setMsg(''); return true" onMouseOut="unPlaceTop(1)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(2)" onMouseOver="placeTop(2); setMsg(''); return true" onMouseOut="unPlaceTop(2)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(3)" onMouseOver="placeTop(3); setMsg(''); return true" onMouseOut="unPlaceTop(3)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(4)" onMouseOver="placeTop(4); setMsg(''); return true" onMouseOut="unPlaceTop(4)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(5)" onMouseOver="placeTop(5); setMsg(''); return true" onMouseOut="unPlaceTop(5)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(6)" onMouseOver="placeTop(6); setMsg(''); return true" onMouseOut="unPlaceTop(6)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
</tr>
<tr>
<td><a href="javascript:void dropIt(0)" onMouseOver="placeTop(0); setMsg(''); return true" onMouseOut="unPlaceTop(0)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(1)" onMouseOver="placeTop(1); setMsg(''); return true" onMouseOut="unPlaceTop(1)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(2)" onMouseOver="placeTop(2); setMsg(''); return true" onMouseOut="unPlaceTop(2)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(3)" onMouseOver="placeTop(3); setMsg(''); return true" onMouseOut="unPlaceTop(3)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(4)" onMouseOver="placeTop(4); setMsg(''); return true" onMouseOut="unPlaceTop(4)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(5)" onMouseOver="placeTop(5); setMsg(''); return true" onMouseOut="unPlaceTop(5)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(6)" onMouseOver="placeTop(6); setMsg(''); return true" onMouseOut="unPlaceTop(6)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
</tr>
<tr>
<td><a href="javascript:void dropIt(0)" onMouseOver="placeTop(0); setMsg(''); return true" onMouseOut="unPlaceTop(0)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(1)" onMouseOver="placeTop(1); setMsg(''); return true" onMouseOut="unPlaceTop(1)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(2)" onMouseOver="placeTop(2); setMsg(''); return true" onMouseOut="unPlaceTop(2)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(3)" onMouseOver="placeTop(3); setMsg(''); return true" onMouseOut="unPlaceTop(3)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(4)" onMouseOver="placeTop(4); setMsg(''); return true" onMouseOut="unPlaceTop(4)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(5)" onMouseOver="placeTop(5); setMsg(''); return true" onMouseOut="unPlaceTop(5)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(6)" onMouseOver="placeTop(6); setMsg(''); return true" onMouseOut="unPlaceTop(6)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
</tr>
<tr>
<td><a href="javascript:void dropIt(0)" onMouseOver="placeTop(0); setMsg(''); return true" onMouseOut="unPlaceTop(0)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(1)" onMouseOver="placeTop(1); setMsg(''); return true" onMouseOut="unPlaceTop(1)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(2)" onMouseOver="placeTop(2); setMsg(''); return true" onMouseOut="unPlaceTop(2)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(3)" onMouseOver="placeTop(3); setMsg(''); return true" onMouseOut="unPlaceTop(3)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(4)" onMouseOver="placeTop(4); setMsg(''); return true" onMouseOut="unPlaceTop(4)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(5)" onMouseOver="placeTop(5); setMsg(''); return true" onMouseOut="unPlaceTop(5)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(6)" onMouseOver="placeTop(6); setMsg(''); return true" onMouseOut="unPlaceTop(6)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
</tr>
<tr>
<td><a href="javascript:void dropIt(0)" onMouseOver="placeTop(0); setMsg(''); return true" onMouseOut="unPlaceTop(0)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(1)" onMouseOver="placeTop(1); setMsg(''); return true" onMouseOut="unPlaceTop(1)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(2)" onMouseOver="placeTop(2); setMsg(''); return true" onMouseOut="unPlaceTop(2)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(3)" onMouseOver="placeTop(3); setMsg(''); return true" onMouseOut="unPlaceTop(3)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(4)" onMouseOver="placeTop(4); setMsg(''); return true" onMouseOut="unPlaceTop(4)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(5)" onMouseOver="placeTop(5); setMsg(''); return true" onMouseOut="unPlaceTop(5)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(6)" onMouseOver="placeTop(6); setMsg(''); return true" onMouseOut="unPlaceTop(6)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
</tr>
<tr>
<td><a href="javascript:void dropIt(0)" onMouseOver="placeTop(0); setMsg(''); return true" onMouseOut="unPlaceTop(0)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(1)" onMouseOver="placeTop(1); setMsg(''); return true" onMouseOut="unPlaceTop(1)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(2)" onMouseOver="placeTop(2); setMsg(''); return true" onMouseOut="unPlaceTop(2)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(3)" onMouseOver="placeTop(3); setMsg(''); return true" onMouseOut="unPlaceTop(3)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(4)" onMouseOver="placeTop(4); setMsg(''); return true" onMouseOut="unPlaceTop(4)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(5)" onMouseOver="placeTop(5); setMsg(''); return true" onMouseOut="unPlaceTop(5)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
<td><a href="javascript:void dropIt(6)" onMouseOver="placeTop(6); setMsg(''); return true" onMouseOut="unPlaceTop(6)"><img border="0" src="https://www.mathsisfun.com/games/images/c4fillempty.gif" height="50" width="50" /></a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</center>
<script language="JavaScript" type="text/javascript">AutoStart();</script>
</body>
<!-- #EndTemplate --></html>