加入收藏 | 设为首页 | 会员中心 | 我要投稿 云计算网_宿迁站长网 (https://www.0527zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

用ASP实现网上“五子棋”大赛 - ASP教程

发布时间:2016-01-15 18:55:48 所属栏目:Asp教程 来源:网络整理
导读:五子棋是大家都非常熟悉的一种益智类游戏,相关的游戏软件也非常多,在此我向大家隆重推出一款新的纯网络版的五子棋,它利用ASP做为开发环境,因此在Internet上
“五子棋”是大家都非常熟悉的一种益智类游戏,相关的游戏软件也非常多,在此我向大家隆重推出一款新的纯“网络版”的五子棋,它利用ASP做为开发环境,因此在Internet上对战的时候无需下载客户端软件,只要你有一个浏览器就可以了。你也可以在局域网上进行这个游戏。

对于ASP,我不想做过多的说明,在以前的文章中,我已经说过很多。

游戏的过程是这样的,我们首先登录,然后可以选择战场,有“金星”、“木星”、“水星”、“火星”、“土星”等五个战场,如果你自认为是一个高手,可以选择金星,否则可以依次选择其它几个星球做为战场。如果这个星球上没有擂主,你就应该以擂主的身份进入,然后别人就可以和你进行对战了。当然,如果所有的星球上都已经开始了战争,那么你就只能等一会儿了。

如果你是以擂主身份进入的,你可以等待别人来和你对战,如果你是以攻擂手的身份登录,你可以很快的和擂主展开战斗。开始战斗后,由擂主执黑先行,然后由攻擂手出招,如此这般。当最后决出胜负的时候,会有相应的提示。

该站点有几个主要的文件是:

Index.asp 登录文件:

Index0.asp中间文件:

Match.asp 比赛文件:

Back0.jpg white0.jpg black0.jpg 中间用到的图形文件,分别指的棋盘,白子和黑子,如下图:

在程序的初始化的时候,将棋盘上分成若干的表格,将背景图片放入其中,形成一个棋盘,然后在放上一个棋子后,再将图片换上相应的白子或黑子就可以了。

先看看登录文件:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title>星球大战之“五子连珠”大赛!</title>
</HEAD>
<BODY>

<p align=center><font size=6>星球大战</font></P>
<table border=1 width=80% align=center>
<tr><td>星球</td><td>擂主</td><td>大战</td><td>攻擂</td></tr>
<tr>
<td>金星</td>
<td>
<%
if application("first1")="" then
%>
<form action=index0.asp?flag=First1 method=post>
<INPUT id=text1 name=txtFirst1 size=10><INPUT id=submit1 name=submit1
type=submit value=进入>
</form>
<%
else
response.write application("first1")
end if
%>
</td>
<td>大战</td>
<td>
<%
if application("second1")="" then
%>

<form action=index0.asp?flag=second1 method=post>
<INPUT id=text1 name=txtSecond1 size=10><INPUT id=submit1
name=submit1 type=submit value=进入>
</form>
<%
else
response.write application("Second1")
end if
%>
</td>
</tr>

<tr>
<td>木星</td>
<td>
<%
if application("first2")="" then
%>
<form action=index0.asp?flag=First2 method=post>
<INPUT id=text1 name=txtFirst2 size=10><INPUT id=submit1 name=submit1
type=submit value=进入>
</form>
<%
else
response.write application("first2")
end if
%>
</td>
<td>大战</td>
<td>
<%
if application("second2")="" then
%>

<form action=index0.asp?flag=second2 method=post>
<INPUT id=text1 name=txtSecond2 size=10><INPUT id=submit1
name=submit1 type=submit value=进入>
</form>
<%
else
response.write application("Second2")
end if
%>
</td>
</tr>

<tr>
<td>金星</td>
<td>
<%
if application("first3")="" then
%>
<form action=index0.asp?flag=First3 method=post>
<INPUT id=text1 name=txtFirst3 size=10><INPUT id=submit1 name=submit1
type=submit value=进入>
</form>
<%
else
response.write application("first3")
end if
%>
</td>
<td>大战</td>
<td>
<%
if application("second3")="" then
%>

<form action=index0.asp?flag=second3 method=post>
<INPUT id=text1 name=txtSecond3 size=10><INPUT id=submit1
name=submit1 type=submit value=进入>
</form>
<%
else
response.write application("Second3")
end if
%>
</td>
</tr>

<tr>
<td>金星</td>
<td>
<%
if application("first4")="" then
%>
<form action=index0.asp?flag=First4 method=post>
<INPUT id=text1 name=txtFirst4 size=10><INPUT id=submit1 name=submit1
type=submit value=进入>
</form>
<%
else
response.write application("first4")
end if
%>
</td>
<td>大战</td>
<td>
<%
if application("second4")="" then
%>

<form action=index0.asp?flag=second4 method=post>
<INPUT id=text1 name=txtSecond4 size=10><INPUT id=submit1
name=submit1 type=submit value=进入>
</form>
<%
else
response.write application("Second4")
end if
%>
</td>
</tr>

<tr>
<td>金星</td>
<td>
<%
if application("first5")="" then
%>
<form action=index0.asp?flag=First5 method=post>
<INPUT id=text1 name=txtFirst5 size=10><INPUT id=submit1 name=submit1
type=submit value=进入>
</form>
<%
else
response.write application("first5")
end if
%>
</td>
<td>大战</td>
<td>
<%
if application("second5")="" then
%>

<form action=index0.asp?flag=second5 method=post>
<INPUT id=text1 name=txtSecond5 size=10><INPUT id=submit1
name=submit1 type=submit value=进入>
</form>
<%
else
response.write application("Second5")
end if
%>
</td>
</tr> 
</table>
</BODY>
</HTML>

(编辑:云计算网_宿迁站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读