<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML LANG="ja">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=Shift_JIS">
<TITLE>オセロ</TITLE>
<!-- Netscape 4 -->
</HEAD>
<BODY BGCOLOR="#CCFFFF">
<BR><BR>
<CENTER>
<!-- 盤 -->
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR><TD WIDTH=14 HEIGHT=22></TD><TD></TD>
<TD ALIGN=CENTER><FONT SiZE=4><B>a</B></FONT></TD>
<TD ALIGN=CENTER><FONT SiZE=4><B>b</B></FONT></TD>
<TD ALIGN=CENTER><FONT SiZE=4><B>c</B></FONT></TD>
<TD ALIGN=CENTER><FONT SiZE=4><B>d</B></FONT></TD>
<TD ALIGN=CENTER><FONT SiZE=4><B>e</B></FONT></TD>
<TD ALIGN=CENTER><FONT SiZE=4><B>f</B></FONT></TD>
<TD ALIGN=CENTER><FONT SiZE=4><B>g</B></FONT></TD>
<TD ALIGN=CENTER><FONT SiZE=4><B>h</B></FONT></TD>
</TR>
<TR><TD></TD><TD COLSPAN=9><IMG SRC="images/board_t.gif" WIDTH=297 HEIGHT=1></TD></TR>
<TR>
<TD><FONT SiZE=4><B>1</B></FONT></TD>
<TD ROWSPAN=8><IMG SRC="images/board_l.gif" WIDTH=1 HEIGHT=296></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(0,0);return false"><IMG NAME="square00" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(1,0);return false"><IMG NAME="square10" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(2,0);return false"><IMG NAME="square20" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(3,0);return false"><IMG NAME="square30" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(4,0);return false"><IMG NAME="square40" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(5,0);return false"><IMG NAME="square50" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(6,0);return false"><IMG NAME="square60" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(7,0);return false"><IMG NAME="square70" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
</TR>
<TR>
<TD><FONT SiZE=4><B>2</B></FONT></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(0,1);return false"><IMG NAME="square01" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(1,1);return false"><IMG NAME="square11" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(2,1);return false"><IMG NAME="square21" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(3,1);return false"><IMG NAME="square31" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(4,1);return false"><IMG NAME="square41" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(5,1);return false"><IMG NAME="square51" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(6,1);return false"><IMG NAME="square61" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(7,1);return false"><IMG NAME="square71" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
</TR>
<TR>
<TD><FONT SiZE=4><B>3</B></FONT></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(0,2);return false"><IMG NAME="square02" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(1,2);return false"><IMG NAME="square12" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(2,2);return false"><IMG NAME="square22" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(3,2);return false"><IMG NAME="square32" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(4,2);return false"><IMG NAME="square42" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(5,2);return false"><IMG NAME="square52" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(6,2);return false"><IMG NAME="square62" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(7,2);return false"><IMG NAME="square72" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
</TR>
<TR>
<TD><FONT SiZE=4><B>4</B></FONT></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(0,3);return false"><IMG NAME="square03" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(1,3);return false"><IMG NAME="square13" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(2,3);return false"><IMG NAME="square23" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(3,3);return false"><IMG NAME="square33" SRC="images/disc_w.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(4,3);return false"><IMG NAME="square43" SRC="images/disc_b.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(5,3);return false"><IMG NAME="square53" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(6,3);return false"><IMG NAME="square63" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(7,3);return false"><IMG NAME="square73" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
</TR>
<TR>
<TD><FONT SiZE=4><B>5</B></FONT></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(0,4);return false"><IMG NAME="square04" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(1,4);return false"><IMG NAME="square14" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(2,4);return false"><IMG NAME="square24" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(3,4);return false"><IMG NAME="square34" SRC="images/disc_b.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(4,4);return false"><IMG NAME="square44" SRC="images/disc_w.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(5,4);return false"><IMG NAME="square54" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(6,4);return false"><IMG NAME="square64" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(7,4);return false"><IMG NAME="square74" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
</TR>
<TR>
<TD><FONT SiZE=4><B>6</B></FONT></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(0,5);return false"><IMG NAME="square05" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(1,5);return false"><IMG NAME="square15" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(2,5);return false"><IMG NAME="square25" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(3,5);return false"><IMG NAME="square35" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(4,5);return false"><IMG NAME="square45" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(5,5);return false"><IMG NAME="square55" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(6,5);return false"><IMG NAME="square65" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(7,5);return false"><IMG NAME="square75" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
</TR>
<TR>
<TD><FONT SiZE=4><B>7</B></FONT></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(0,6);return false"><IMG NAME="square06" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(1,6);return false"><IMG NAME="square16" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(2,6);return false"><IMG NAME="square26" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(3,6);return false"><IMG NAME="square36" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(4,6);return false"><IMG NAME="square46" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(5,6);return false"><IMG NAME="square56" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(6,6);return false"><IMG NAME="square66" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(7,6);return false"><IMG NAME="square76" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
</TR>
<TR>
<TD><FONT SiZE=4><B>8</B></FONT></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(0,7);return false"><IMG NAME="square07" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(1,7);return false"><IMG NAME="square17" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(2,7);return false"><IMG NAME="square27" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(3,7);return false"><IMG NAME="square37" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(4,7);return false"><IMG NAME="square47" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(5,7);return false"><IMG NAME="square57" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(6,7);return false"><IMG NAME="square67" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
<TD><A HREF="javascript:void(0)" onClick="clicked(7,7);return false"><IMG NAME="square77" SRC="images/board.gif" WIDTH=37 HEIGHT=37 BORDER=0></A></TD>
</TR>
</TABLE>
<BR><BR>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 BGCOLOR="#336666">
<TR><TD COLSPAN=6><ILAYER NAME="msg1" WIDTH=240><LAYER NAME="msg2">
<FONT COLOR="#000000" SIZE="+1">●</FONT><FONT COLOR="#FFFF33" SIZE="+1"> の手番</FONT>
</LAYER></ILAYER></TD></TR>
<TR><TD WIDTH=40><BR></TD>
<TD ALIGN=RIGHT><FONT COLOR="#000000" SIZE="+1">●</FONT></TD>
<TD ALIGN=LEFT><ILAYER NAME="b_discs1" WIDTH=30><LAYER NAME="b_discs2">
<FONT COLOR="#FFFF33" SIZE="+1">2</FONT></LAYER></ILAYER></TD>
<TD ALIGN=RIGHT><FONT COLOR="#FFFFFF" SIZE="+1">●</FONT></TD>
<TD ALIGN=LEFT><ILAYER NAME="w_discs1" WIDTH=30><LAYER NAME="w_discs2">
<FONT COLOR="#FFFF33" SIZE="+1">2</FONT></LAYER></ILAYER></TD>
<TD><BR></TD></TR>
</TABLE>
</CENTER>
<SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
<!--
function clicked(x, y) {
if(squares[x][y]) // すでに石がある
return;
if(!place(x, y, turn)) // 置けない
return;
put_msg("<FONT COLOR='#" + ((turn == 1) ? "000000" : "FFFFFF")
+ "' SIZE='+1'>●</FONT><FONT COLOR='#FFFF33' SIZE='+1'> "
+ "abcdefgh".charAt(x) + " " + String(y + 1) + "</FONT>");
squares[x][y] = turn;
document.images["square" + String(x) + String(y)].src = (turn == 1) ? img_b.src : img_w.src;
discs_sum++;
if(turn == 1) { // 黒の手番
b_discs++;
with(document.b_discs1.document.b_discs2.document) {
open();
write("<FONT COLOR='#FFFF33' SIZE='+1'>" + String(b_discs) + "</FONT>");
close();
}
}
else {
with(document.w_discs1.document.w_discs2.document) {
open();
write("<FONT COLOR='#FFFF33' SIZE='+1'>" + String(discs_sum - b_discs) + "</FONT>");
close();
}
}
delay(500);
var x2, y2;
var cnt;
// 相手の石を返す
var dx, dy;
for(dx = -1; dx < 2; dx++) {
for(dy = -1; dy < 2; dy++) {
if(dx || dy) {
x2 = x + dx;
y2 = y + dy;
if(x2 < 0 || x2 > 7 || y2 < 0 || y2 > 7)
continue;
if(squares[x2][y2] == 3 - turn) { // 相手の石
for(cnt = 1; ; cnt++) {
x2 += dx;
y2 += dy;
if(x2 < 0 || x2 > 7 || y2 < 0 || y2 > 7)
break;
if(!squares[x2][y2]) // 空き
break;
if(squares[x2][y2] == turn) { // 自分の石
// 挟んだ
x2 = x;
y2 = y;
for(; cnt; cnt--) {
x2 += dx;
y2 += dy;
squares[x2][y2] = turn;
document.images["square" + String(x2) + String(y2)].src = (turn == 1) ? img_b.src : img_w.src;
if(turn == 1) // 黒の手番
b_discs++;
else
b_discs--;
with(document.b_discs1.document.b_discs2.document) {
open();
write("<FONT COLOR='#FFFF33' SIZE='+1'>" + String(b_discs) + "</FONT>");
close();
}
with(document.w_discs1.document.w_discs2.document) {
open();
write("<FONT COLOR='#FFFF33' SIZE='+1'>" + String(discs_sum - b_discs) + "</FONT>");
close();
}
delay(100);
}
break;
}
}
}
}
}
}
// 相手の番?
// 置けるところがあるか?
var f = 0;
for(x2 = 0; x2 < 8; x2++) {
for(y2 = 0; y2 < 8; y2++) {
if(!squares[x2][y2]) { // 空き
if(place(x2, y2, 3 - turn)) { // 置ける
turn = 3 - turn; // 相手の番
put_msg("<FONT COLOR='#" + ((turn == 1) ? "000000" : "FFFFFF")
+ "' SIZE='+1'>●</FONT><FONT COLOR='#FFFF33' SIZE='+1'> の手番</FONT>");
return;
}
if(place(x2, y2, turn)) // 自分は置ける
f = 1;
}
}
}
if(f) { // 自分は置ける
// 相手はパス
for(cnt = 3; cnt; cnt--) {
put_msg("<FONT COLOR='#" + ((turn == 1) ? "FFFFFF" : "000000")
+ "' SIZE='+1'>●</FONT><FONT COLOR='#FFFF33' SIZE='+1'> はパス!</FONT>");
delay(300);
put_msg("");
delay(200);
}
put_msg("<FONT COLOR='#" + ((turn == 1) ? "000000" : "FFFFFF")
+ "' SIZE='+1'>●</FONT><FONT COLOR='#FFFF33' SIZE='+1'> の手番</FONT>");
return;
}
// 終了
put_msg(((b_discs * 2 == discs_sum)
? "<FONT COLOR='#FFFF33' SIZE='+1'>引き分け!</FONT>"
: "<FONT COLOR='#" + ((b_discs > discs_sum - b_discs) ? "000000" : "FFFFFF")
+ "' SIZE='+1'>●</FONT><FONT COLOR='#FFFF33' SIZE='+1'> の勝ち!</FONT>")
+ " <A HREF='javascript:location.reload()' STYLE='text-decoration:none'>"
+ "<ILAYER BGCOLOR='#CC3300'><FONT COLOR='#FFFF66'><B> もう一度遊ぶ </B></FONT></ILAYER></A>");
}
// 置ける?
function place(x, y, side) {
// 回りのマスを調べる
var dx, dy;
for(dx = -1; dx < 2; dx++) {
for(dy = -1; dy < 2; dy++) {
if(dx || dy) {
var x2 = x + dx;
var y2 = y + dy;
if(x2 < 0 || x2 > 7 || y2 < 0 || y2 > 7)
continue;
if(squares[x2][y2] != 3 - side) // 空き or 自分の石
continue;
for(; ; ) {
x2 += dx;
y2 += dy;
if(x2 < 0 || x2 > 7 || y2 < 0 || y2 > 7)
break;
if(!squares[x2][y2]) // 空き
break;
if(squares[x2][y2] == side) // 自分の石
return 1; // 置ける
}
}
}
}
return 0;
}
function put_msg(msg) {
with(document.msg1.document.msg2.document) {
open();
write(msg);
close();
}
}
function delay(time) {
var dt = new Date();
var tm = dt.getTime() + time;
while(dt.getTime() < tm)
dt = new Date();
}
squares = new Array();
squares.length = 8;
for(x = 0; x < 8; x++)
squares[x] = [0, 0, 0, 0, 0, 0, 0, 0];
squares[4][3] = squares[3][4] = 1; // 黒
squares[3][3] = squares[4][4] = 2; // 白
b_discs = 2;
discs_sum = 4;
img_b = new Image(37, 37);
img_b.src = "images/disc_b.gif";
img_w = new Image(37, 37);
img_w.src = "images/disc_w.gif";
turn = 1; // 黒の番
//-->
</SCRIPT>
</BODY>
</HTML>
|