您现在的位置: 万盛学电脑网 >> 程序编程 >> 网络编程 >> 安卓开发 >> 正文

用ASP实现网上五子棋大赛的方法

作者:佚名    责任编辑:admin    更新时间:2022-06-22

本文导航

1、首页2、用ASP实现网上五子棋大赛-2

下面我们给大家介绍一下用ASP实现网上五子棋大赛吧!希望大家可以在这里学习!

 

 

 

<%

Response.Write "擂主:" & application("first" & session("class"))

& "    攻擂:" & application("second" & session

("class"))

if Request.QueryString("pos")<>"" then

application("pos" & session("class") & Request.QueryString("pos"))

=true

end if

%>

 

<%

'Response.Write application("aaa")

if application("first" & session("class"))=session("nice") then

color="black"

if Request.QueryString("pos")<>"" then

if session("last")="" then session("last")="abc"

if session("last")<> Request.QueryString("pos") then

application(application("first" & session("class")))=false

if application("second" & session("class"))<>"" then application

(application("second" & session("class")))=true

session("last")=Request.QueryString("pos")

END IF

end if

else

if application("second" & session("class"))=session("nice") then

color="white"

if Request.QueryString("pos")<>"" then

'if session("last")="" then session("last")="abc"

if session("last")<> Request.QueryString("pos") then

application(application("first" & session("class")))=true

application(application("second" & session("class")))=false

session("last")=Request.QueryString("pos")

END IF

end if

else

if application("second" & session("class"))="" then

application("second" & session("class"))=session("nice")

color="white"

if Request.QueryString("pos")<>"" then

if session("last")="" then session("last")="abc"

if session("last")<> Request.QueryString("pos") then

application(application("first" & session("class")))=true

application(application("second" & session("class")))=false

session("last")=Request.QueryString("pos")

END IF

end if

else

color=""

end if

end if

end if

Response.Write "

cellpadding=0>"

for i=1 to 16

Response.Write "

"

 

for j=1 to 16

if application("pos" & session("class") & cstr(i) & "_" & cstr(j))=""

then

application("color" & session("class") & "_" & Request.QueryString

("pos"))=color

Response.Write "

"

 

else

Response.Write "

" & chr(13)

 

end if

next

Response.Write "

"

 

next

Response.Write "

'判断输赢

if application("first" & session("class"))=session("nice") then

m="black"

h="white"

else

h="black"

m="white"

end if

'横向判断"-"

for i=1 to 15

win=false

loss=false

five_me=0

five_he=0

for j=1 to 15

if application("color" & session("class") & "_" & cstr(i) & "_" & cstr

(j))=m then

five_me=five_me+1

five_he=0

elseif application("color" & session("class") & "_" & cstr(i) & "_" &

cstr(j))=h then

five_me=0

five_he=five_he+1

else

five_me=0

five_he=0

end if

if five_me=5 then

win=true

loss=false

exit for

elseif five_he=5 then

win=false

loss=true

exit for

end if

next

if win or loss then exit for

next

if win then

response.write "你赢了!"

application(application("first" & session("class")))=false

application(application("second" & session("class")))=false

end if

if loss then

response.write "对不起,你输了!"

application(application("first" & session("class")))=false

application(application("second" & session("class")))=false

end if

'列向判断"|"

for j=1 to 15

win=false

loss=false

five_me=0

five_he=0

for i=1 to 15

if application("color" & session("class") & "_" & cstr(i) & "_" & cstr

(j))=m then

five_me=five_me+1

five_he=0

elseif application("color" & session("class") & "_" & cstr(i) & "_" &

cstr(j))=h then

five_me=0

five_he=five_he+1

else

five_me=0

five_he=0

end if

if five_me=5 then

win=true

loss=false

exit for

elseif five_he=5 then

win=false

loss=true

exit for

end if

next

if win or loss then exit for

next

if win then

response.write "你赢了!"

application(application("first" & session("class")))=false

application(application("second" & session("class")))=false

end if

if loss then

response.write "对不起,你输了!"

application(application("first" & session("class")))=false

application(application("second" & session("class")))=false

end if

'斜向判断"/"

for i=1 to 11

win=false

loss=false

five_me=0

five_he=0

for j=i+4 to 1 step -1

if application("color" & session("class") & "_" & cstr(j) & "_" & cstr

(i+5-j))=m then

five_me=five_me+1

five_he=0

elseif application("color" & session("class") & "_" & cstr(j) & "_" &

cstr(i+5-j))=h then

five_me=0

five_he=five_he+1

else

five_me=0

five_he=0

end if

if five_me=5 then

win=true

loss=false

exit for

elseif five_he=5 then

win=false

loss=true

exit for

end if

next