五子棋-宇宙幻影(DOS).zip

  • PUDN用户
    了解作者
  • C/C++
    开发工具
  • 425KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2020-12-12 18:12
    上传日期
五子棋,实现五子棋的人人对战以及人机对战
五子棋-宇宙幻影(DOS).zip
  • FONT
  • HZK16
    162.8KB
  • WZQ
  • WHILE5.HS
    1.6KB
  • TABLE15.GIF
    148.1KB
  • WZQ.PAL
    768B
  • BLACK5.HS
    1.6KB
  • YZHY.GIF
    59.9KB
  • SOURCE
  • MYOBJ
  • SVGA_NUM.H
    57B
  • SVGA_NUM.C
    1.6KB
  • SPRINTC.H
    259B
  • SPRINTC.C
    2.2KB
  • SVGA_NUM.OBJ
    2.3KB
  • SPRINTC.OBJ
    3.1KB
  • SVGACC.LIB
    67.2KB
  • INCLUDE
  • SVGA_IMG.H
    2.7KB
  • KEYS.H
    695B
  • S_BUTTOM.H
    3.3KB
  • SVGACC.H
    10KB
  • WZQ.PRJ
    70B
  • FIVE.C
    29.5KB
  • WZQ.PIF
    967B
  • SVGA.FNT
    1.5KB
  • WZQ.DOC
    42KB
  • WZQ.EXE
    172.3KB
  • README.EXE
    11.4KB
  • WZQ.ICO
    766B
内容介绍
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <alloc.h rel='nofollow' onclick='return false;'> #include <dos.h> #include <keys.h> #include <svgacc.h> #include <svga_img.h> #include "myobj\\sprintc.h" #include "myobj\\svga_num.h" #include <s_buttom.h> #define Size 15 #define SizeX 225 #define SizeX4 900 void interrupt (*oldtime)(); void interrupt newtime(); unsigned char *StrMin(); unsigned long PClock,PTime,Old_PTime, TClock,TTime,Old_TTime; BLOCKS Stone[2]; RasterBlock far *BUF,*CurBUF; unsigned char Table[Size][Size]; unsigned char Player[Size][Size][4],Computer[Size][Size][4]; unsigned char PlayerX[Size][Size],ComputerX[Size][Size]; PAL Pal1; int x=7,y=7,ox,oy, People=0, Com=1; char Players=1,Begin=0, PlayAble=1, BackAble=0; int Gx,Gy,Gsize, UnDo[2][2]; int mx,my,mb, X=120,Y=40, Steps=0; int nums; int Hx,Hy, Ex,Ey, TempX,TempY; unsigned char buf[12],Temp1[12],Temp2[12]; typedef struct{ char Step[10][2]; char Point,Nums, Able; char Continue; int Time; }STEP; STEP JS; int JS_LEVELS,JS_LEVELS_Max=5; char *DS[]= {"0CCCCC0","0CCCCCP","PCCCCCP",\ "0PPPPP0","0PPPPPC","CPPPPPC",\ "0CCCC0","0CCCCP", "0CC0CC0","0CC0CCP","PCC0CCP",\ "0C0CCC0","PC0CCC0","0C0CCCP","PC0CCCP",\ "0PPPP0","0PPPPC", "0PP0PP0","0PP0PPC","CPP0PPC",\ "0P0PPP0","CP0PPP0","0P0PPPC","CP0PPPC",\ /* 24 */ "0C0CC0","0CCC0",\ "0P0PP0","0PPP0",\ "0C0C0", "00CC0",\ /* 30 */ "00CCCP", "0CC0CP","0C0CCP","0CCC0P","0CC0CP","0C0CCP",\ "00C0", "0P0P0", "00PP0",\ "00PPPC","0PP0PC","0P0PPC", "0PPP0C","0PP0PC","0P0PPC",\ /* 45 */ "00CCP", "0CC0P", "0P0", "00PPC","0PP0C",\ "00CP", "0C0P", "00PC","0P0C",\ /* 54 */ "P0CCCP", "PC0CCP", "P0CCP", "PC0CP", \ "C0PPPC", "CP0PPC", "C0PPC", "CP0PC" }; int DS_nums=62; main() { int key; InitGame(); Choice(); do{ /* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM Mouse MMMMMMMMMMMMMMMMMMMMMMMM*/ mousestatus(&mx,&my,&mb); if( PlayAble && Players==1 && mb==1 && mx>X-20 && mx<X+420 && my>Y-20 && my<Y+420 ) { wait(mb,1); x=(mx-X+15)/29; y=(my-Y+15)/29; PlayerPut(); } if( PlayAble && Players==0 ) { ComputerPut(); } if( mb==1 && mx>560 && mx<630 && my>440 && my<470 ) { setvect(0x1c,oldtime); mousehide(); buttom(560,440,630,470,1,"主菜单",26,16,'d'); wait(mb,1); Choice(); } if( mb==1 && mx>560 && mx<630 && my>400 && my<430 && Steps>1 && BackAble ) { mousehide(); buttom(560,400,630,430,1,"悔一步",26,16,'d'); wait(mb,1); BackOne(); } /* KKKKKKKKKKKKKKKKKKKKKKK Key KKKKKKKKKKKKKKKKKKKKKKKKKKKKKK*/ if( bioskey(1) && Players==1 ) { key=inkey(); switch( key ) { case ESC: setvect(0x1c,oldtime); mousehide(); buttom(560,440,630,470,1,"主菜单",26,16,'d'); Choice(); break; case UP: if( y>0 ) { y--; MoveCursor(); } break; case DOWN: if( y<Size-1 ){y++; MoveCursor(); } break; case LEFT: if( x>0 ) { x--; MoveCursor(); } break; case RIGHT: if( x<Size-1 ){x++; MoveCursor(); } break; case SPACE: case ENTER: if( PlayAble ) PlayerPut(); break; case 'u': case 'U': BackOne(); break; } } if( Players==1 && PTime!=Old_PTime ) { Old_PTime=PTime; buttom(45,420,85,440,26,"",14,16,'d'); show_num(1,25,422,15,PTime); } }while(1<2); } BackOne() { Table[UnDo[0][0]][UnDo[0][1]]=Table[UnDo[1][0]][UnDo[1][1]]=0xff; Steps-=2; PlayAble=1; FenXi(); HideCursor(); InterFace(); ReShow(); ShowCursor(); setvect(0x1c,newtime); BackAble=0; } PlayerPut() /* PlayerPut */ { if( x>=0 && x<Size && y>=0 && y<Size && Table[y][x]==0xff ) { UnDo[0][0]=y; UnDo[0][1]=x; Steps++; Table[y][x]=People; memset(Player[y][x],0xff,4); memset(Computer[y][x],0xff,4); mousehide(); HideCursor(); putimage(X+x*29-14,Y+y*29-14,Stone[Steps%2],2); ShowCursor(); mouseshow(); wait(mb,1); if( Begin==People && (PlayerX[y][x]==1 || PlayerX[y][x]==3 || PlayerX[y][x]==4) ) { printc(210,420,0,15,"x3y3玩家禁手负"); setvect(0x1c,oldtime); PlayAble=0; return; } Players=0; Turns(1); FenXi(); Winner(); } } ComputerPut() /* ComputerPut */ { JS.Time=0; if( JS.Able==1 && (JS.Point==0 || \ ( y==JS.Step[JS.Point-1][0] && x==JS.Step[JS.Point-1][1] ))) { y=JS.Step[JS.Point][0]; x=JS.Step[JS.Point][1]; JS.Point+=2; } else { JS.Continue=1; for(JS_LEVELS=1; JS_LEVELS<=JS_LEVELS_Max; JS_LEVELS++) if (JS.Continue==1 ) { JISHUAN(-1); } if( JS.Able==1 && (JS.Point==0 || \ (y==JS.Step[JS.Point-1][0] && x==JS.Step[JS.Point-1][1]))) { y=JS.Step[JS.Point][0]; x=JS.Step[JS.Point][1]; JS.Point+=2; } else { Put(); x=TempX; y=TempY; if( *StrMin(Computer[y][x])>30 && *StrMin(Player[y][x])>26 \ && PlayerX[y][x]==0 ) { JS.Continue=1; for(JS_LEVELS=1; JS_LEVELS<=JS_LEVELS_Max; JS_LEVELS++) if (JS.Continue==1 ) { JISHUAN_2(-1); } if( JS.Able==1 ) { JS.Able=0; y=JS.Step[0][0]; x=JS.Step[0][1]; } else { Put(); x=TempX; y=TempY; } } } } if( Steps==0 ) { x=7; y=7; } UnDo[1][0]=y; UnDo[1][1]=x; Steps++; Table[y][x]=Com; memset(Player[y][x],0xff,4); memset(Computer[y][x],0xff,4); mousehide(); HideCursor(); blkget(X+x*29-14,Y+y*29-14,X+x*29+15,Y+y*29+15,BUF); { int i; for(i=0; i<3; i++) { if(i>0) delays(2); blkput(1,X+x*29-14,Y+y*29-14,BUF); delays(2); putimage(X+x*29-14,Y+y*29-14,Stone[Steps%2],2); } } ShowCursor(); mouseshow(); Turns(0); Players=1; FenXi(); Winner(); JS.Time=0; BackAble=1; } Winner() /* Winner */ { int i,j,k; for( i=0; i<Size; i++) for( j=0; j<Size; j++) for( k=0; k<4; k++) { if( Player[i][j][k]>=3 && Player[i][j][k]<6 ) { printc(250,420,0,15,"x3y3玩家胜"); setvect(0x1c,oldtime); PlayAble=0; } if( Computer[i][j][k]>=0 && Computer[i][j][k]<3 ) { printc(250,420,0,15,"x3y3电脑胜"); setvect(0x1c,oldtime); PlayAble=0; } } } /* ////////////////////////////////// F X ///////////////////////////// */ FenXi() /******** Fen Xi ********/ { int i,j; memset(Player,0xef,SizeX4); memset(Computer,0xef,SizeX4); memset(PlayerX,0,SizeX); memset(ComputerX,0,SizeX); GetLine(People,People,'P'); GetLine(Com,Com,'C'); GetLine(People,0xff,'0'); GetLine(Com,0xff,'0'); GetLineBC(); for(i=0; i<Size; i++ ) for(j=0; j<Size; j++ ) { if( *StrMin(Player[i][j])>27 ) { if( StrChr(Player[i][j],37,4)>=2 && StrChr(Player[i][j],39,4)==0 ) PlayerX[i][j]=1; if( StrChr(Player[i][j],39,4)>=2 ) PlayerX[i][j]=3; if( StrChr(Player[i][j],37,4)==1 && StrChr(Player[i][j],39,4)==1 ) PlayerX[i][j]=2; } if( *StrMin(Computer[i][j])>27 ) { if( StrChr(Computer[i][j],28,4)>=2 && StrChr(Computer[i][j],30,4)==0 ) ComputerX[i][j]=1; if( StrChr(Computer[i][j],30,4)>=2 ) ComputerX[i][j]=3; if( StrChr(Computer[i][j],28,4)==1 && StrChr(Computer[i][j],30,4)==1 ) ComputerX[i][j]=2; } } } GetLineBC() { int i,j,k; int IK[4][2]={ 0,1, 1,0, 1,1, 1,-1 }; for(i=0; i<Size; i++) for(j=0; j<Size; j++) for(k=0; k<4; k++) { if( Computer[i][j][k]==28 ) { if( Table[i+IK[
评论
    相关推荐
    • c++课件
      c++课件c++课件c++课件c++课件c++课件c++课件c++课件c++课件c++课件c++课件c++课件c++课件c++课件
    • SourceStyler C++
      用DEV-C++写代码很方便,就是不能格式化有点郁闷 c++格式化的好工具 效率高
    • C++ primer
      本书是久负盛名的C++经典教程,其内容是C++大师Stanley B. Lippman丰富的实践经验和C++标准委员会原负责人Josée Lajoie对C++标准深入理解的完美结合,已经帮助全球无数程序员学会了C++。本版对前一版进行了彻底的...
    • c++yuyanbiancheng
      这是C和C++集成的编程环境!这是C和C++集成的编程环境!这是C和C++集成的编程环境!这是C和C++集成的编程环境!这是C和C++集成的编程环境!
    • effective C++
      有关C++编程方面的检验性介绍,对由C转向C++,和有C++编程基础的程序员有帮助,不过是英文版
    • C++ Primer
      这本处适合各个阶段的C++程序员,这本书可以帮助初学者快速入门,里面有最实用,最容易理解的代码;同时这也是有经验的C++程序员最好的一本参考手册
    • c++ primer
      经典的c++书籍,中文第三版,由大名鼎鼎的潘爱民同志翻译并推荐的,是C++学习人员和开发人员必备资料
    • effective c++
      C++经典书籍Effective C++ By Scott Meyers, 已译成中文,chm格式,方便检阅 Uploaded by save (chaisave@sohu.com)
    • C++ PRrimer
      本书是久负盛名的C++经典教程,其内容是C++大师Stanley B. Lippman丰富的实践经验和C++标准委员会原负责人Josée Lajoie对C++标准深入理解的完美结合,已经帮助全球无数程序员学会了C++。本版对前一版进行了彻底的...
    • C++ Primer
      本书是久负盛名的C++经典教程引,其内容是C++大师Stanley B. Lippman丰富的实践经验和C++标准委员会原负责人Josée Lajoie对C++标准深入理解的完美结合,已经帮助全球无数程序员学会了C++