首页 | 网站开发 | 数据库技术 | 操作系统 | 创意设计 | 组网专栏 | 信息安全 | 综合应用 | 会员登录 | 会员投稿
当前位置:首页>>网站开发>>asp>>正文
Othello游戏源程序
文章出处:联动天下 作者:联动天下 发布时间:2005-12-21
<%@ language = vbscript %><%
'程序版权所有者: http://www.rainfall.com/othello/rules/othellorules.html
Response.Buffer=True dim p(8,8),b(8,8),x(8,8)
p(1,1) = 7 : p(8,1) = 7 : p(8,8) = 7 : p(1,8) = 7 : p(3,3) = 6 : p(3,4) = 6
p(3,5) = 6 : p(3,6) = 6 : p(4,3) = 6 : p(4,6) = 6 : p(5,3) = 6 : p(5,4) = 6
p(6,3) = 6 : p(6,4) = 6 : p(6,5) = 6 : p(6,6) = 6 : p(1,3) = 5 : p(1,6) = 5
p(3,1) = 5 : p(3,8) = 5 : p(6,1) = 5 : p(6,8) = 5 : p(8,3) = 5 : p(8,6) = 5
p(1,4) = 4 : p(1,5) = 4 : p(4,1) = 4 : p(4,8) = 4 : p(5,1) = 4 : p(5,8) = 4
p(8,4) = 4 : p(8,5) = 4 : p(2,3) = 3 : p(2,4) = 3 : p(2,5) = 3 : p(2,6) = 3
p(3,2) = 3 : p(3,7) = 3 : p(4,2) = 3 : p(4,7) = 3 : p(3,2) = 3 : p(3,7) = 3
p(4,2) = 3 : p(4,7) = 3 : p(5,2) = 3 : p(5,7) = 3 : p(6,2) = 3 : p(6,7) = 3
p(7,3) = 3 : p(7,4) = 3 : p(7,5) = 3 : p(7,6) = 3 : p(1,2) = 2 : p(1,7) = 2
p(2,1) = 2 : p(2,8) = 2 : p(7,1) = 2 : p(7,8) = 2 : p(8,2) = 2 : p(8,7) = 2
p(2,2) = 1 : p(2,7) = 1 : p(7,2) = 1 : p(7,7) = 1 for i = 1 to 8
for j = 1 to 8 b(i,j) = cint(request("b" & i & j)) next next
sel = request("sel") select case sel case 0 ' init for i=1 to 8
for j=1 to 8 b(i,j) = 0 next next
b(4,4) = 1 : b(5,5) = 1 : b(4,5) = 2 : b(5,4) = 2 case 1 ' human put
for i=1 to 8 for j=1 to 8
if request("n" & i & j & ".x") <> "" then call put(i,j,1) next next
case 2 call mark(2) ' com mark cpass = 0 for i=1 to 8
for j=1 to 8 if x(i,j) <> 0 then cpass = 1 next next
if cpass <> 0 then for i=1 to 8 for j=1 to 8
if x(i,j) = 1 then if pp < p(i,j) then pp = p(i,j)
ii = i jj = j end if end if next next
call put(ii,jj,2) end if call mark(1) ' human mark hpass = 0
for i=1 to 8 for j=1 to 8 if x(i,j) <> 0 then hpass = 1 next
next if cpass <> 0 and hpass = 0 then sel = 1 ' com again
if cpass = 0 and hpass = 0 then sel = 3 ' end end select%>
<script language="vbscript" runat=server>sub mark(c) for i=1 to 8 for j=1 to 8
if (( c1(i,j,c) = 1 or c2(i,j,c) = 1 or c3(i,j,c) = 1 or _
c4(i,j,c) = 1 or c5(i,j,c) = 1 or c6(i,j,c) = 1 or _
c7(i,j,c) = 1 or c8(i,j,c) = 1 ) and b(i,j) = 0 ) then
x(i,j) = 1 else x(i,j) = 0 end if next nextend sub
function c1(i,j,c) if c = 1 then cc = 2 if c = 2 then cc = 1 for k=1 to 8
if ( j-k < 1 ) then c1 = 0 : exit function
if ( k = 1 and b(i,j-k) <> cc ) then c1 = 0 : exit function
if ( k > 1 and b(i,j-k) = 0 ) then c1 = 0 : exit function
if ( k > 1 and b(i,j-k) = c ) then c1 = 1 : exit function nextend function
function c2(i,j,c) if c = 1 then cc = 2 if c = 2 then cc = 1 for k=1 to 8
if ( i+k > 8 ) then c2 = 0 : exit function
if ( k = 1 and b(i+k,j) <> cc ) then c2 = 0 : exit function
if ( k > 1 and b(i+k,j) = 0 ) then c2 = 0 : exit function
if ( k > 1 and b(i+k,j) = c ) then c2 = 1 : exit function nextend function
function c3(i,j,c) if c = 1 then cc = 2 if c = 2 then cc = 1 for k=1 to 8
if ( j+k > 8 ) then c3 = 0 : exit function
if ( k = 1 and b(i,j+k) <> cc ) then c3 = 0 : exit function
if ( k > 1 and b(i,j+k) = 0 ) then c3 = 0 : exit function
if ( k > 1 and b(i,j+k) = c ) then c3 = 1 : exit function nextend function
function c4(i,j,c) if c = 1 then cc = 2 if c = 2 then cc = 1 for k=1 to 8
if ( i-k < 1 ) then c4 = 0 : exit function
if ( k = 1 and b(i-k,j) <> cc ) then c4 = 0 : exit function
if ( k > 1 and b(i-k,j) = 0 ) then c4 = 0 : exit function
if ( k > 1 and b(i-k,j) = c ) then c4 = 1 : exit function nextend function
function c5(i,j,c) if c = 1 then cc = 2 if c = 2 then cc = 1 for k=1 to 8
if ( i+k > 8 or j-k < 1 ) then c5 = 0 : exit function
[返回顶部↑] [推荐好友] [查看评论]
用户名: 新注册) 密码: 匿名评论 [查看评论] 发表评论
评论内容:(不能超过120字,需审核后才会公布,请自觉遵守互联网相关政策法规。
↑文章搜索↑
关键字:
范 围:
开始搜索
§相关文章§
·一个基于ASP的标题广告管理
·一个基于ASP的标题广告管理
·聊天室实现私聊(四)
·聊天室实现私聊(三)
·聊天室实现私聊(二)
·聊天室实现私聊(一)
·利用ASP规划聊天室
·ASP字数计算函数
§推荐文章§
| 网络教程 | 学习教程 | 域名交易 | 域名注册 | 域名主机 | 域名查询 | 虚拟主机 | 空间代理 | 域名代理 | 企业黄页 | 站长工具 | 在线客服 | 求职招聘 | 天下英才网 | 佛山人才网