Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

polish tic tac toe style 3

Status
Not open for further replies.

Lrnmore

Technical User
Jun 11, 2003
743
US
This is a tic tac toe "script" human always goes
first, can select char(X or O). My next is to implement
a routine for the computer to go first.

And if someone wants to do that it's OK but do it in
another thread please. I want to figure it out myself.

But I enjoyed writing it. What I would like, is some
pointers on making my grid look better.

And if anyone finds a bug I would also like to know
that. It was funny I had written the thing and played
it "logically" and I couldn't beat it. I ask my son
to play it beats is first time....duhh. Had to write
the defend corners section for unlogical play. Just like
the real world huh.

Enjoy it make any changes you want for yourself or your
site.

Thanks again to everyone who participates in the forum
alot of what I used in this script came from knowledge
absorbed here.

Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html><head><title>Tic-Tac-To Ver 1.0000</title>
<style  type=&quot;text/css&quot;>
 #tac{background-color: #FEBF01; color: #000000;
   font-size: 30px; font-family: serif; font-weight:bold;
    border: medium none;}
</style>
	
<script language=&quot;JavaScript&quot;>
var pos = new Array(&quot;[ABC]&quot;,&quot;[DEF]&quot;,&quot;[GHI]&quot;,&quot;[ADG]&quot;,
    &quot;[BEH]&quot;,&quot;[CFI]&quot;,&quot;[CEG]&quot;,&quot;[AEI]&quot;);
var crnrs = new Array(&quot;[DAB]&quot;,&quot;[BCF]&quot;,&quot;[FIH]&quot;,&quot;[HGD]&quot;);
var plr = 0;	
var turn = &quot;&quot;; //  x or o
var mvs = 0;
var X_str = &quot;&quot;; // x move history
var O_str = &quot;&quot;; // y move history
var defcrnr = false;
var csafe = true;

function init() {
document.tictac.reset();
turn = &quot;&quot;;
X_str = &quot;&quot;;
O_str = &quot;&quot;;
mvs = 0;
plr = 0;
defcrnr = false;
csafe = true;
}

function ck_win(str) {
for(var i=0;i<pos.length;i++) {
		var restr = new RegExp(pos[i],&quot;g&quot;);
		strb = str.match(restr);
		if(strb && strb.length == 3) { alert(turn+ &quot; wins!&quot;); init(); break;}}
if(mvs == 9) { alert(&quot;Meow Cat Wins-Try Again&quot;); init();}		
}
		
function tic(el) {
if(plr == 0) { alert(&quot;Select Player to Start..&quot;); }
  else { mvs++; el.value = turn;
if(turn == 'X') { X_str += el.name; ck_win(X_str); turn = 'O';
		if(mvs == 1 && turn == 'O'){ comp = 'O';}}
else { O_str += el.name; ck_win(O_str); turn = 'X';
	    if(mvs == 1 && turn == 'X'){ comp = 'X'; }}}
if(plr != 0 && comp == turn) { if(comp == 'X') { calcmv(turn,O_str,X_str); }
     else{calcmv(turn,X_str,O_str);}}}
	 
function calcmv(turn,strhm,strpc) {
 var defend = false;
 var pcwin = false;
 var cat = true;
 d = document.tictac;
	if(mvs == 1 && d.E.value == &quot;&quot;){
	   var cmd = 'tic(d.E)';
	    cat = false; defcrnr = true;}
    else { if(mvs == 1) {var cmd = 'tic(d.C)'; cat = false;}}
	 if(mvs > 1){ for(j=0;j<pos.length;j++) {
				   restr = new RegExp(pos[j],&quot;g&quot;);
				   strb = strpc.match(restr);
				   if(strb && strb.length == 2){
				   comp_pos = pos[j].substring(1,4);
				   comp_str = strb[0]+strb[1]; 
				    for(k=0;k<comp_pos.length;k++){
					 cval = comp_str.indexOf(comp_pos.charAt(k))
					 if(cval == -1 && d[comp_pos.charAt(k)].value == &quot;&quot;){
				   cmd = 'tic(d.' +comp_pos.charAt(k)+')';
				    cat = false; pcwin = true; break;}}}}}
	 if(mvs > 1 && !pcwin){  for(var j=0;j<pos.length;j++) {
	 		  	   var restr = new RegExp(pos[j],&quot;g&quot;);
				   strb = strhm.match(restr);
				   if(strb && strb.length == 2){
				   comp_pos = pos[j].substring(1,4);
				   comp_str = strb[0]+strb[1];
				   for(var k=0;k<comp_pos.length;k++){
				   cval = comp_str.indexOf(comp_pos.charAt(k));
				   if(cval == -1 && d[comp_pos.charAt(k)].value == &quot;&quot;){
				   defend = true; 
				   cmd = 'tic(d.'+comp_pos.charAt(k)+')';
				    cat = false; break;}}}}}
	if(!defend && !pcwin){ if(defcrnr){ 
	               for(k=0;k<crnrs.length;k++) {
			   	   restr = new RegExp(crnrs[k],&quot;g&quot;);
	               strb = strhm.match(restr);
					if(strb && strb.length == 2) {
					comp_pos = crnrs[k].substring(1,4)
					comp_str = strb[0] + strb[1];
					for(j=0;j<comp_pos.length;j++) {
					if(comp_str.indexOf(comp_pos.charAt(j)) == -1 &&
					d[comp_pos.charAt(j)].value == &quot;&quot;){
					csafe = false; cat = false; defcrnr = false;
					cmd = 'tic(d.'+comp_pos.charAt(j)+')'; break;}}}}}
			   	    if(csafe) { for(j=0;j<pos.length;j++) {
				   restr = new RegExp(pos[j],&quot;g&quot;);
				   strb = strpc.match(restr);
				    if(strb && strb.length == 1){ 
					 nwpos = '['+strb[0]+']';
					 nwpos = new RegExp(nwpos,&quot;g&quot;);
					 nwposb = pos[j].replace(nwpos,&quot;&quot;);
		if(d[nwposb.charAt(1)].value == &quot;&quot; &&  d[nwposb.charAt(2)].value == &quot;&quot;){
		  cmd = 'tic(d.'+nwposb.charAt(1)+')';
		   cat = false; break;}}}}}
		if(cat){ for(var e=0;e<d.elements.length;e++) {
		  if(d.elements[e].value == &quot;&quot;) { 
		  cmd = 'tic(d.'+d.elements[e].name+')'; break;}}}
   // write random fill for corner take
csafe = true;
setTimeout(cmd,1200);
}
</script>
</head>
<body><form name=&quot;tictac&quot;>
<table width=&quot;74&quot; height=&quot;72&quot; bgcolor='white' cellpadding=&quot;0&quot; cellspacing=&quot;2&quot;><tbody>
<tr><td width=&quot;23&quot;>
<input id=&quot;tac&quot; type=&quot;text&quot; name=&quot;A&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;>
</td><td width=&quot;20&quot; bgcolor='blue' rowspan=&quot;5&quot;>   </td><td width=&quot;23&quot;>
<input id=&quot;tac&quot; type=&quot;text&quot; name=&quot;B&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;>
</td><td width=&quot;20&quot; bgcolor='blue' rowspan=&quot;5&quot;>   </td><td width=&quot;23&quot;>
<input id=&quot;tac&quot; type=&quot;text&quot; name=&quot;C&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;>
</td></tr><tr><td colspan=&quot;5&quot; height=&quot;6&quot; bgcolor='blue'> </td></tr>
<tr><td width=&quot;23&quot;>
<input id=&quot;tac&quot; type=&quot;text&quot; name=&quot;D&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;>
</td><td width=&quot;23&quot;>
<input id=&quot;tac&quot; type=&quot;text&quot; name=&quot;E&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;>
</td><td width=&quot;23&quot;>
<input id=&quot;tac&quot; type=&quot;text&quot; name=&quot;F&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;>
</td></tr><tr><td colspan=&quot;5&quot; height=&quot;6&quot; bgcolor='blue'> </td></tr>
<tr><td width=&quot;23&quot;>
<input id=&quot;tac&quot; type=&quot;text&quot; name=&quot;G&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;>
</td><td width=&quot;23&quot;>
<input id=&quot;tac&quot; type=&quot;text&quot; name=&quot;H&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;>
</td><td width=&quot;23&quot;>
<input id=&quot;tac&quot; type=&quot;text&quot; name=&quot;I&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;>
</td><td width=&quot;23&quot;>
</td></tr></tbody></table>
<br><input type=&quot;button&quot; value=&quot; X Goes First &quot; onClick=&quot;turn='X'; plr = 1;&quot;>
<br><br><input type=&quot;button&quot; value=&quot; O Goes First &quot; onClick=&quot;turn='O'; plr = 1;&quot;>
<br><br><input type=&quot;button&quot; value=&quot; New Game &quot; onClick=&quot;reset();init();&quot;
</form></body></html>



2b||!2b
 
Working on the style update right now. But here's a theoretical question. Who wants to play a game that you can never win????

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html><head><title>Tic-Tac-To Ver 1.0000</title>
<style type=&quot;text/css&quot;>
.tac{
background-color: #FEBF01;
color: #000000;
font-size: 30px;
font-family: serif;
font-weight:bold;
border: black solid 1px;
text-align:center;
padding: 0px;
margin: 0px 1px 0px;
height: 40px;
width: 40px;
}
</style>

<script language=&quot;JavaScript&quot;>
var pos = new Array(&quot;[ABC]&quot;,&quot;[DEF]&quot;,&quot;[GHI]&quot;,&quot;[ADG]&quot;,
&quot;[BEH]&quot;,&quot;[CFI]&quot;,&quot;[CEG]&quot;,&quot;[AEI]&quot;);
var crnrs = new Array(&quot;[DAB]&quot;,&quot;[BCF]&quot;,&quot;[FIH]&quot;,&quot;[HGD]&quot;);
var plr = 0;
var turn = &quot;&quot;; // x or o
var mvs = 0;
var X_str = &quot;&quot;; // x move history
var O_str = &quot;&quot;; // y move history
var defcrnr = false;
var csafe = true;

function init() {
document.tictac.reset();
turn = &quot;&quot;;
X_str = &quot;&quot;;
O_str = &quot;&quot;;
mvs = 0;
plr = 0;
defcrnr = false;
csafe = true;
}

function ck_win(str) {
for(var i=0;i<pos.length;i++) {
var restr = new RegExp(pos,&quot;g&quot;);
strb = str.match(restr);
if(strb && strb.length == 3) { alert(turn+ &quot; wins!&quot;); init(); break;}}
if(mvs == 9) { alert(&quot;Meow Cat Wins-Try Again&quot;); init();}
}

function tic(el) {
if(plr == 0) { alert(&quot;Select Player to Start..&quot;); }
else { mvs++; el.value = turn;
if(turn == 'X') { X_str += el.name; ck_win(X_str); turn = 'O';
if(mvs == 1 && turn == 'O'){ comp = 'O';}}
else { O_str += el.name; ck_win(O_str); turn = 'X';
if(mvs == 1 && turn == 'X'){ comp = 'X'; }}}
if(plr != 0 && comp == turn) { if(comp == 'X') { calcmv(turn,O_str,X_str); }
else{calcmv(turn,X_str,O_str);}}}

function calcmv(turn,strhm,strpc) {
var defend = false;
var pcwin = false;
var cat = true;
d = document.tictac;
if(mvs == 1 && d.E.value == &quot;&quot;){
var cmd = 'tic(d.E)';
cat = false; defcrnr = true;}
else { if(mvs == 1) {var cmd = 'tic(d.C)'; cat = false;}}
if(mvs > 1){ for(j=0;j<pos.length;j++) {
restr = new RegExp(pos[j],&quot;g&quot;);
strb = strpc.match(restr);
if(strb && strb.length == 2){
comp_pos = pos[j].substring(1,4);
comp_str = strb[0]+strb[1];
for(k=0;k<comp_pos.length;k++){
cval = comp_str.indexOf(comp_pos.charAt(k))
if(cval == -1 && d[comp_pos.charAt(k)].value == &quot;&quot;){
cmd = 'tic(d.' +comp_pos.charAt(k)+')';
cat = false; pcwin = true; break;}}}}}
if(mvs > 1 && !pcwin){ for(var j=0;j<pos.length;j++) {
var restr = new RegExp(pos[j],&quot;g&quot;);
strb = strhm.match(restr);
if(strb && strb.length == 2){
comp_pos = pos[j].substring(1,4);
comp_str = strb[0]+strb[1];
for(var k=0;k<comp_pos.length;k++){
cval = comp_str.indexOf(comp_pos.charAt(k));
if(cval == -1 && d[comp_pos.charAt(k)].value == &quot;&quot;){
defend = true;
cmd = 'tic(d.'+comp_pos.charAt(k)+')';
cat = false; break;}}}}}
if(!defend && !pcwin){ if(defcrnr){
for(k=0;k<crnrs.length;k++) {
restr = new RegExp(crnrs[k],&quot;g&quot;);
strb = strhm.match(restr);
if(strb && strb.length == 2) {
comp_pos = crnrs[k].substring(1,4)
comp_str = strb[0] + strb[1];
for(j=0;j<comp_pos.length;j++) {
if(comp_str.indexOf(comp_pos.charAt(j)) == -1 &&
d[comp_pos.charAt(j)].value == &quot;&quot;){
csafe = false; cat = false; defcrnr = false;
cmd = 'tic(d.'+comp_pos.charAt(j)+')'; break;}}}}}
if(csafe) { for(j=0;j<pos.length;j++) {
restr = new RegExp(pos[j],&quot;g&quot;);
strb = strpc.match(restr);
if(strb && strb.length == 1){
nwpos = '['+strb[0]+']';
nwpos = new RegExp(nwpos,&quot;g&quot;);
nwposb = pos[j].replace(nwpos,&quot;&quot;);
if(d[nwposb.charAt(1)].value == &quot;&quot; && d[nwposb.charAt(2)].value == &quot;&quot;){
cmd = 'tic(d.'+nwposb.charAt(1)+')';
cat = false; break;}}}}}
if(cat){ for(var e=0;e<d.elements.length;e++) {
if(d.elements[e].value == &quot;&quot;) {
cmd = 'tic(d.'+d.elements[e].name+')'; break;}}}
// write random fill for corner take
csafe = true;
setTimeout(cmd,1200);
}
</script>
</head>
<body><form name=&quot;tictac&quot;>
<table cellpadding=0 cellspacing=0><tbody>
<tr>
<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;A&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;B&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;C&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
</tr>
<tr>
<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;D&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;E&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;F&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
</tr>
<tr>
<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;G&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;H&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;I&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
</tr>
</tbody></table>
<br><input type=&quot;button&quot; value=&quot; X Goes First &quot; onClick=&quot;turn='X'; plr = 1;&quot;>
<br><br><input type=&quot;button&quot; value=&quot; O Goes First &quot; onClick=&quot;turn='O'; plr = 1;&quot;>
<br><br><input type=&quot;button&quot; value=&quot; New Game &quot; onClick=&quot;reset();init();&quot;
</form></body></html>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
mwolf00, I can see that you've got a full plate today [lol].
 
Code:
Sorry about the bad post - I never use [i]...

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html><head><title>Tic-Tac-To Ver 1.0000</title>
<style  type=&quot;text/css&quot;>
 .tac{
 	background-color: #FEBF01; 
 	color: #000000;
   	font-size: 30px; 
   	font-family: serif; 
   	font-weight:bold;
	border: black solid 1px; 
	text-align:center;  
	padding: 0px; 
	margin: 0px 1px 0px;
	height: 40px;
	width: 40px;
    }
</style>

<script language=&quot;JavaScript&quot;>
var pos = new Array(&quot;[ABC]&quot;,&quot;[DEF]&quot;,&quot;[GHI]&quot;,&quot;[ADG]&quot;,
    &quot;[BEH]&quot;,&quot;[CFI]&quot;,&quot;[CEG]&quot;,&quot;[AEI]&quot;);
var crnrs = new Array(&quot;[DAB]&quot;,&quot;[BCF]&quot;,&quot;[FIH]&quot;,&quot;[HGD]&quot;);
var plr = 0;
var turn = &quot;&quot;; //  x or o
var mvs = 0;
var X_str = &quot;&quot;; // x move history
var O_str = &quot;&quot;; // y move history
var defcrnr = false;
var csafe = true;

function init() {
document.tictac.reset();
turn = &quot;&quot;;
X_str = &quot;&quot;;
O_str = &quot;&quot;;
mvs = 0;
plr = 0;
defcrnr = false;
csafe = true;
}

function ck_win(str) {
for(var i=0;i<pos.length;i++) {
        var restr = new RegExp(pos[i],&quot;g&quot;);
        strb = str.match(restr);
        if(strb && strb.length == 3) { alert(turn+ &quot; wins!&quot;); init(); break;}}
if(mvs == 9) { alert(&quot;Meow Cat Wins-Try Again&quot;); init();}
}

function tic(el) {
if(plr == 0) { alert(&quot;Select Player to Start..&quot;); }
  else { mvs++; el.value = turn;
if(turn == 'X') { X_str += el.name; ck_win(X_str); turn = 'O';
        if(mvs == 1 && turn == 'O'){ comp = 'O';}}
else { O_str += el.name; ck_win(O_str); turn = 'X';
        if(mvs == 1 && turn == 'X'){ comp = 'X'; }}}
if(plr != 0 && comp == turn) { if(comp == 'X') { calcmv(turn,O_str,X_str); }
     else{calcmv(turn,X_str,O_str);}}}

function calcmv(turn,strhm,strpc) {
 var defend = false;
 var pcwin = false;
 var cat = true;
 d = document.tictac;
    if(mvs == 1 && d.E.value == &quot;&quot;){
       var cmd = 'tic(d.E)';
        cat = false; defcrnr = true;}
    else { if(mvs == 1) {var cmd = 'tic(d.C)'; cat = false;}}
     if(mvs > 1){ for(j=0;j<pos.length;j++) {
                   restr = new RegExp(pos[j],&quot;g&quot;);
                   strb = strpc.match(restr);
                   if(strb && strb.length == 2){
                   comp_pos = pos[j].substring(1,4);
                   comp_str = strb[0]+strb[1];
                    for(k=0;k<comp_pos.length;k++){
                     cval = comp_str.indexOf(comp_pos.charAt(k))
                     if(cval == -1 && d[comp_pos.charAt(k)].value == &quot;&quot;){
                   cmd = 'tic(d.' +comp_pos.charAt(k)+')';
                    cat = false; pcwin = true; break;}}}}}
     if(mvs > 1 && !pcwin){  for(var j=0;j<pos.length;j++) {
                      var restr = new RegExp(pos[j],&quot;g&quot;);
                   strb = strhm.match(restr);
                   if(strb && strb.length == 2){
                   comp_pos = pos[j].substring(1,4);
                   comp_str = strb[0]+strb[1];
                   for(var k=0;k<comp_pos.length;k++){
                   cval = comp_str.indexOf(comp_pos.charAt(k));
                   if(cval == -1 && d[comp_pos.charAt(k)].value == &quot;&quot;){
                   defend = true;
                   cmd = 'tic(d.'+comp_pos.charAt(k)+')';
                    cat = false; break;}}}}}
    if(!defend && !pcwin){ if(defcrnr){
                   for(k=0;k<crnrs.length;k++) {
                      restr = new RegExp(crnrs[k],&quot;g&quot;);
                   strb = strhm.match(restr);
                    if(strb && strb.length == 2) {
                    comp_pos = crnrs[k].substring(1,4)
                    comp_str = strb[0] + strb[1];
                    for(j=0;j<comp_pos.length;j++) {
                    if(comp_str.indexOf(comp_pos.charAt(j)) == -1 &&
                    d[comp_pos.charAt(j)].value == &quot;&quot;){
                    csafe = false; cat = false; defcrnr = false;
                    cmd = 'tic(d.'+comp_pos.charAt(j)+')'; break;}}}}}
                       if(csafe) { for(j=0;j<pos.length;j++) {
                   restr = new RegExp(pos[j],&quot;g&quot;);
                   strb = strpc.match(restr);
                    if(strb && strb.length == 1){
                     nwpos = '['+strb[0]+']';
                     nwpos = new RegExp(nwpos,&quot;g&quot;);
                     nwposb = pos[j].replace(nwpos,&quot;&quot;);
        if(d[nwposb.charAt(1)].value == &quot;&quot; &&  d[nwposb.charAt(2)].value == &quot;&quot;){
          cmd = 'tic(d.'+nwposb.charAt(1)+')';
           cat = false; break;}}}}}
        if(cat){ for(var e=0;e<d.elements.length;e++) {
          if(d.elements[e].value == &quot;&quot;) {
          cmd = 'tic(d.'+d.elements[e].name+')'; break;}}}
   // write random fill for corner take
csafe = true;
setTimeout(cmd,1200);
}
</script>
</head>
<body><form name=&quot;tictac&quot;>
<table cellpadding=0 cellspacing=0><tbody>
<tr>
	<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;A&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
	<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;B&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
	<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;C&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
</tr>
<tr>
	<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;D&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
	<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;E&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
	<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;F&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
</tr>
<tr>
	<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;G&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
	<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;H&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
	<td><input class=&quot;tac&quot; type=&quot;text&quot; name=&quot;I&quot; value=&quot;&quot; size=&quot;1&quot; onClick=&quot;tic(this);&quot;></td>
</tr>
</tbody></table>
<br><input type=&quot;button&quot; value=&quot; X Goes First &quot; onClick=&quot;turn='X'; plr = 1;&quot;>
<br><br><input type=&quot;button&quot; value=&quot; O Goes First &quot; onClick=&quot;turn='O'; plr = 1;&quot;>
<br><br><input type=&quot;button&quot; value=&quot; New Game &quot; onClick=&quot;reset();init();&quot;
</form></body></html>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
That's a good point, I have considered a set of
radio buttons to knock out some of the routines. So
that it would be vulnerable. I will add that to my list
along with the computer offensive set.

Thanks,

2b||!2b
 
Lrnmore, if you click the center square 3 times in a row you win. I didn't look for a bug fix or anything since I'm at work, but that's something I noticed the first game.

-kaht


But here's a theoretical question. Who wants to play a game that you can never win????

Everybody that pays a monthly fee to play Everquest or any other MMORPG!!
 
Star to Kaht for beating the computer!!!!

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
kaht,

thanks, now don't fix it for me.
I just appreciate the info. I'll add it to my list.

2b||!2b
 
mwolf00,

Thank you very much, looks much better now.

2b||!2b
 
anytime...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Star to mwolf for making it look better!!!

:)

-kaht
 
ROFL, I just realized that when you typed polish you meant polish as in clean. I was thinking polish as in &quot;from polland&quot;. I was wondering how polish tictactoe was different from american tictactoe.

-kaht
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top