?? -一個c語言編寫的箱子游戲.txt
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0032)http://wbco.pc163.com.cn/bc1.htm -->
<HTML><HEAD><TITLE>編程技巧-一個C語言編寫的箱子游戲</TITLE>
<META http-equiv=Content-Language content=zh-cn>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<META content=FrontPage.Editor.Document name=ProgId>
<SCRIPT language=JavaScript>var currentpos,timer;function initialize(){timer=setInterval("scrollwindow()",50);}function sc(){clearInterval(timer);}function scrollwindow(){currentpos=document.body.scrollTop;window.scroll(0,++currentpos);if (currentpos != document.body.scrollTop)sc();}document.onmousedown=scdocument.ondblclick=initialize</SCRIPT>
<STYLE type=text/css>A:link {
COLOR: #009f00; TEXT-DECORATION: none
}
A:active {
COLOR: #009f00; TEXT-DECORATION: none
}
A:visited {
COLOR: #009f00; TEXT-DECORATION: none
}
A:hover {
COLOR: #00b500; TEXT-DECORATION: underline
}
BODY {
CURSOR: url('link.ani')
}
</STYLE>
<STYLE fprolloverstyle>A:hover {
FONT-WEIGHT: bold
}
</STYLE>
</HEAD>
<BODY leftMargin=0 topMargin=0>
<TABLE cellSpacing=0 cellPadding=0 width="74%" border=0>
<TBODY>
<TR>
<TD width="100%"><A href="http://wbco.pc163.com.cn/index.htm"><IMG
height=17 src="編程技巧-一個C語言編寫的箱子游戲.files/sy.gif" width=45 border=0></A><A
href="http://wbco.pc163.com.cn/news.htm"><IMG height=17
src="編程技巧-一個C語言編寫的箱子游戲.files/NEWS1.gif" width=59 border=0></A><A
href="http://wbco.pc163.com.cn/computer-jx.htm"><IMG height=17
src="編程技巧-一個C語言編寫的箱子游戲.files/Jx-top.gif" width=59 border=0></A><A
href="http://wbco.pc163.com.cn/cpark.htm"><IMG height=17
src="編程技巧-一個C語言編寫的箱子游戲.files/Dlyd.gif" width=59 border=0></A><A
href="http://wbco.pc163.com.cn/jy.htm"><IMG height=17
src="編程技巧-一個C語言編寫的箱子游戲.files/Jyzn.gif" width=59 border=0></A><A
href="http://wbco.pc163.com.cn/z-student.htm"><IMG height=17
src="編程技巧-一個C語言編寫的箱子游戲.files/Zsqk.gif" width=59 border=0></A><A
href="http://wbco.pc163.com.cn/zy.htm"><IMG height=17
src="編程技巧-一個C語言編寫的箱子游戲.files/Zyjs.gif" width=59 border=0></A><A
href="http://wbco.pc163.com.cn/bbs.htm"><IMG height=17
src="編程技巧-一個C語言編寫的箱子游戲.files/Bbs.gif" width=59 border=0></A><A
href="http://wbco.pc163.com.cn/rec1.htm"><IMG height=17
src="編程技巧-一個C語言編寫的箱子游戲.files/navi_dir9.gif" width=73
border=0></A></TD></TR></TBODY></TABLE>
<TABLE height=1 cellSpacing=0 cellPadding=0 width=770 border=0>
<TBODY>
<TR>
<TD vAlign=top width=201 bgColor=#528feb height=65>
<TABLE height=60 cellSpacing=0 cellPadding=0 width=115 border=0>
<TBODY>
<TR>
<TD width=115><IMG height=65
src="編程技巧-一個C語言編寫的箱子游戲.files/wbjxtb.gif" width=120 border=0>
<P> </P>
<P><A href="http://wbco.pc163.com.cn/bc2.htm"><FONT color=#ffffff
size=2>萬年歷問題的Qbasic解決方法</FONT></A></P>
<P><A href="http://wbco.pc163.com.cn/bc.htm"><FONT color=#ffffff
size=2>日歷表的顯示</FONT></A></P>
<P> </P>
<P> </P>
<P> </P></TD></TR></TBODY></TABLE></TD>
<TD vAlign=top width=633 height=1 rowSpan=2>
<TABLE borderColor=#528feb height=12 cellSpacing=0 cellPadding=0
width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top width="97%" bgColor=#528feb height=12 rowSpan=2><IMG
height=67 src="" width=630 border=0></TD>
<TD vAlign=top width="3%" bgColor=#ffffff height=1><IMG height=14
src="" width=18 border=0></TD></TR>
<TR>
<TD vAlign=top width="3%" bgColor=#528feb height=53> </TD></TR>
<TR>
<TD vAlign=top width="100%" colSpan=2 height=586>
<TABLE borderColor=#528feb height=604 cellSpacing=0 cellPadding=0
width="100%" border=1>
<TBODY>
<TR>
<TD vAlign=top width="100%" height=604>
<TABLE height=574 cellSpacing=0 cellPadding=0 width="111%"
border=0>
<TBODY>
<TR>
<TD vAlign=top width="7%" bgColor=#ffffff height=1><IMG
height=28 src="" width=37 border=0></TD>
<TD vAlign=center width="93%" bgColor=#ffffff height=1>
<TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD width="100%"><FONT color=#009f00 size=2><A
href="http://wbco.pc163.com.cn/index.htm">首頁</A>>><A
href="http://wbco.pc163.com.cn/cpark.htm">電腦園地</A>>>編程技巧>>一個C語言編寫的箱子游戲
</FONT><FONT color=#ff6c26
size=2>雙擊自動滾屏</FONT></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD vAlign=top borderColor=#008000 width="100%" colSpan=2
height=1><IMG height=3 src="" width=489 border=0></TD></TR>
<TR>
<TD vAlign=top width="100%" colSpan=2 height=567>
<TABLE height=587 cellSpacing=0 cellPadding=0
width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top width=650
background=編程技巧-一個C語言編寫的箱子游戲.files/Bgline2.gif
height=19> </TD></TR>
<TR>
<TD vAlign=top width=650 height=505>
<TABLE height=520 cellSpacing=0 cellPadding=0
width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top width="3%"
background=編程技巧-一個C語言編寫的箱子游戲.files/002.gif
height=520> </TD>
<TD vAlign=top width="92%"
background=編程技巧-一個C語言編寫的箱子游戲.files/002.gif
height=520>
<P align=center><FONT
color=#000080>一個C語言編寫的推箱子游戲</FONT></P>
<P><FONT size=2>/* 一個C語言編寫的推箱子游戲源代碼 */<BR>/*
本游戲是字符模式的,請不要在中文dos下運行。本游戲在TURBO C下調試通過
*/<BR>#include <dos.h><BR>#include
<stdio.h><BR>#include
<ctype.h><BR>#include
<conio.h><BR>#include
<bios.h><BR>#include
<alloc.h><BR><BR><BR>/*
定義二維數組ghouse來記錄屏幕上各點的狀態,<BR>其中:0表示什么都沒有,'b'表示箱子,'w'表示墻壁,'m'表示目的地,'i'表示箱子在目的地。
*/<BR>char ghouse[20][20];<BR><BR>/*
以下函數為直接寫屏函數,很酷的函數哦!是我朋友告訴我的。 */<BR>char far
*screen=(char far* )0xb8000000;<BR>void
putchxy(int y,int x,char ch,char fc,char
bc)<BR>{<BR>screen[(x*160)+(y<<1)+0]=ch;<BR>screen[(x*160)+(y<<1)+1]=(bc*16)+fc;<BR>}<BR><BR>/*
定義判斷是否勝利的數據結構 */<BR>typedef struct winer
{<BR>int x,y;<BR>struct winer
*p;<BR>}winer;<BR><BR>/* 箱子位置的數據結構 */<BR>typedef
struct boxs {<BR>int x,y;<BR>struct boxs
*next;<BR>}boxs;<BR><BR>/* 在特定的坐標上畫墻壁并用數組記錄狀態的函數
*/<BR>void printwall(int x,int
y)<BR>{<BR>putchxy(y-1,x-1,219,GREEN,BLACK);<BR>ghouse[x][y]='w';<BR>}<BR><BR>/*
在特定的坐標上畫箱子并用數組記錄狀態的函數 */<BR>void printbox(int
x,int
y)<BR>{<BR>putchxy(y-1,x-1,10,WHITE,BLACK);<BR>ghouse[x][y]='b';<BR>}<BR><BR>/*
在特定的坐標上畫目的地并用數組記錄狀態的函數 */<BR>void
printwhither1(int x,int y,winer **win,winer
**pw)<BR>{<BR>winer
*qw;<BR>putchxy(y-1,x-1,'*',YELLOW,BLACK);<BR>ghouse[x][y]='m';<BR>if(*win==NULL)<BR>{<BR>*win=*pw=qw=(winer*
)malloc(sizeof(winer));<BR>(*pw)->x=x;(*pw)->y=y;(*pw)->p=NULL;<BR>}<BR>else<BR>{<BR>qw=(winer*
)malloc(sizeof(winer));<BR>qw->x=x;qw->y=y;(*pw)->p=qw;(*pw)=qw;qw->p=NULL;<BR>}<BR>}<BR><BR><BR>/*
在特定的坐標上畫目的地并用數組記錄狀態的函數 */<BR>void
printwhither(int x,int
y)<BR>{<BR>putchxy(y-1,x-1,'*',YELLOW,BLACK);<BR>ghouse[x][y]='m';<BR>}<BR>/*
在特定的坐標上畫人的函數 */<BR>void printman(int x,int
y)<BR>{<BR>gotoxy(y,x);<BR>_AL=02;_CX=01;_AH=0xa;<BR>geninterrupt(0x10);<BR>}<BR><BR>/*
在特定的坐標上畫箱子在目的地上并用數組記錄狀態的函數 */<BR>void
printboxin(int x,int
y)<BR>{<BR>putchxy(y-1,x-1,10,YELLOW,BLACK);<BR>ghouse[x][y]='i';<BR>}<BR><BR>/*
初始化函數,初始化數組和屏幕 */<BR>void init()<BR>{<BR>int
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -