作者: Gao (人可以活的簡單) 看板: sources
標題: [轉錄][壽司] 踩地雷
時間: Thu Jul 27 13:16:24 1995 閒閒沒事做,寫了個踩地雷來玩玩,我是用
Borland C++ 3.1 ,歡迎大家批評指教。 /*********************/
/* mine.cpp */
/* Programmed by Gao */
/* Jul/25/1995 */
/* ver 1.0 */
/*********************/
#include
#include
#include
#include
#include
#define len 15
#define total 40 //number of mines
#define mine 0x0010
#define flag 0x0020
#define show 0x0040
#define none 0x0080
#define lenx 16
#define leny 16
#define left 1
#define right 2
#define middle 3
#define go 0
#define win 1
#define lose 2 int bx,by,map[lenx][leny];
int unflags,result;
int second;
struct time time0,time1; void Show(int x,int y,int p)
{
char value[2];
value[1]='\0';
asm{
mov ax,2
int 33h //hide mouse cursor
}
if (p!=flag && p!=none)
{
setfillstyle(SOLID_FILL,DARKGRAY);
bar(bx x*len,by y*len,bx (x 1)*len-1,by (y 1)*len-1);
setcolor(BLACK);
if (map[x][y-1] & show) line(bx x*len,by y*len,bx (x 1)*len,by y*len);
if (map[x][y 1] & show) line(bx x*len,by (y 1)*len,bx (x 1)*len,by (y 1)*len);
if (map[x-1][y] & show) line(bx x*len,by y*len,bx x*len,by (y 1)*len);
if (map[x 1][y] & show) line(bx (x 1)*len,by y*len,bx (x 1)*len,by (y 1)*len);
}
switch (p)
{
case mine:
setcolor(RED);
setfillstyle(SOLID_FILL,BLACK);
fillellipse(bx x*len len/2,by y*len len/2,len/3,len/3);
break;
case flag:
setfillstyle(SOLID_FILL,RED);
bar(bx x*len len/4,by y*len len/4,bx (x 1)*len-len/4,by (y 1)*len-len/4);
break;
case none:
setfillstyle(SOLID_FILL,LIGHTGRAY);
bar(bx x*len,by y*len,bx (x 1)*len-1,by (y 1)*len-1);
setcolor(WHITE);
line(bx x*len,by y*len,bx (x 1)*len-1,by y*len);
line(bx x*len,by y*len,bx x*len,by (y 1)*len-1);
setcolor(DARKGRAY);
line(bx (x 1)*len-1,by y*len,bx (x 1)*len-1,by (y 1)*len-1);
line(bx x*len,by (y 1)*len-1,bx (x 1)*len-1,by (y 1)*len-1);
break;
default:
if (p>0)
{
moveto(bx x*len,by y*len);
value[0]='0' (map[x][y] & 0x000F);
setcolor(p 8);
settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
outtext(value);
}
break;
}
asm{
mov ax,1
int 33h //show mouse cursor
}
} void ShowUnflags(void)
{
char value[4];
if (unflags>=0)
{
value[3]='\0';
setfillstyle(SOLID_FILL,BLACK);
bar(bx,by-35,bx 100,by-5);
moveto(bx,by-35);
settextstyle(DEFAULT_FONT,HORIZ_DIR,4);
setcolor(RED);
value[0]='0' unflags/100;
value[1]='0' (unflags/10);
value[2]='0' unflags;
outtext(value);
}
} void ShowTime(void)
{
char value[4];
value[3]='\0';
setfillstyle(SOLID_FILL,BLACK);
bar(bx lenx*len-100,by-35,bx lenx*lenx*len,by-5);
moveto(bx lenx*len-100,by-35);
settextstyle(DEFAULT_FONT,HORIZ_DIR,4);
setcolor(RED);
value[0]='0' (second/100);
value[1]='0' (second/10);
value[2]='0' second;
outtext(value);
} void DrawMap(void)
{
int x,y;
for (x=0;x=0 && x i=0 && y j0 && (map[x][y] & show))
{
count=0;
for (i=-1;i<=1;i )
for (j=-1;j<=1;j )
if (x i>=0 && x i=0 && y j=0 && x i=0 && y j=0 && (i k)=0 && (j l)=1 || time1.ti_sec=0)
{
time0.ti_sec=time1.ti_sec;
second ;
ShowTime();
}
}while (t3==0);
*x=(t1-bx)/len;
*y=(t2-by)/len;
*key=t3;
}while (*x<0 || *x>=lenx || *y<0 || *y>=leny);
} void Play(int x,int y,int key)
{
int count,i,j;
do
{
GetMouse(&x,&y,&key);
Press(x,y,key);
if (unflags==0)
{
count=total;
for (i=0;i dmwc@gcn.net.tw
※ X-Sign: 0RM4OI9NSPLaD3HPEMmk (99/06/12 21:36:09 )
------
**********************************************************
哈哈&兵燹
最會的2大絕招 這個不會與那個也不會 哈哈哈 粉好
Delphi K.Top的K.Top分兩個字解釋Top代表尖端的意思,希望本討論區能提供Delphi的尖端新知
K.表Knowlege 知識,就是本站的標語:Open our mind