六子棋代码

  • Y8_635888
    了解作者
  • 39.8KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-14 10:36
    上传日期
C语言课程设计,六子棋代码。 人机对弈或人人对弈,六子连珠者胜; 开始后,即显示一张30*30的棋盘,然后选择先后,黑先行; 自行设计代表棋盘信息的数据结构,自行设计计算机的下棋规则和判断胜负的规则。
6子棋.rar
  • 6子棋
  • Chinese.c
    1.8KB
  • STARTjiuji.C
    660B
  • TUXIANG.cpp
    144B
  • 2CENG3.C
    3.5KB
  • shiyan.c
    418B
  • head.h
    2.6KB
  • MOUSE.C
    1.6KB
  • Sample.CPP
    106B
  • MOUSE1.C
    3.3KB
  • Menu.C
    7.8KB
  • BGIDEMO.C
    39.4KB
  • Tempevaluation.c
    3.6KB
  • GAME.c
    6.2KB
  • INIT.C
    279B
  • Sample.C
    67B
  • shubiao1.c
    864B
  • NONAME00.C
    399B
  • Save.c
    3KB
  • SHUBIAO.C
    5.3KB
  • Draw.c
    3.4KB
  • New.C
    1.4KB
  • TUICHU.C
    2.3KB
  • 2CENG4.C
    3.5KB
  • 1.CPP
    638B
  • SHUBIAO3.C
    5KB
  • dos.h
    1.3KB
  • 2 CENG.C
    2.4KB
  • Evaluation.c
    8.9KB
  • TUXIANG.C
    1.2KB
  • 2ceng2 .c
    3.1KB
  • JINGGAO.CPP
    2KB
  • Ai.c
    2.2KB
  • main.c
    201B
内容介绍
/* GRAPHICS DEMO FOR Borland C++ 3.0 Copyright (c) 1987,88,91 Borland International. All rights reserved. From the command line, use: bcc bgidemo graphics.lib */ #ifdef __TINY__ #error BGIDEMO will not run in the tiny model. #endif #include <dos.h> #include <math.h> #include <conio.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <graphics.h> #define ESC 0x1b /* Define the escape key */ #define TRUE 1 /* Define some handy constants */ #define FALSE 0 /* Define some handy constants */ #define PI 3.14159 /* Define a value for PI */ #define ON 1 /* Define some handy constants */ #define OFF 0 /* Define some handy constants */ #define NFONTS 11 char *Fonts[NFONTS] = { "DefaultFont", "TriplexFont", "SmallFont", "SansSerifFont", "GothicFont", "ScriptFont", "SimplexFont", "TriplexScriptFont", "ComplexFont", "EuropeanFont", "BoldFont" }; char *LineStyles[] = { "SolidLn", "DottedLn", "CenterLn", "DashedLn", "UserBitLn" }; char *FillStyles[] = { "EmptyFill", "SolidFill", "LineFill", "LtSlashFill", "SlashFill", "BkSlashFill", "LtBkSlashFill", "HatchFill", "XHatchFill", "InterleaveFill", "WideDotFill", "CloseDotFill" }; char *TextDirect[] = { "HorizDir", "VertDir" }; char *HorizJust[] = { "LeftText", "CenterText", "RightText" }; char *VertJust[] = { "BottomText", "CenterText", "TopText" }; struct PTS { int x, y; }; /* Structure to hold vertex points */ int GraphDriver; /* The Graphics device driver */ int GraphMode; /* The Graphics mode value */ double AspectRatio; /* Aspect ratio of a pixel on the screen*/ int MaxX, MaxY; /* The maximum resolution of the screen */ int MaxColors; /* The maximum # of colors available */ int ErrorCode; /* Reports any graphics errors */ struct palettetype palette; /* Used to read palette info */ /* */ /* Function prototypes */ /* */ void Initialize(void); void ReportStatus(void); void TextDump(void); void Bar3DDemo(void); void RandomBars(void); void TextDemo(void); void ColorDemo(void); void ArcDemo(void); void CircleDemo(void); void PieDemo(void); void BarDemo(void); void LineRelDemo(void); void PutPixelDemo(void); void PutImageDemo(void); void LineToDemo(void); void LineStyleDemo(void); void CRTModeDemo(void); void UserLineStyleDemo(void); void FillStyleDemo(void); void FillPatternDemo(void); void PaletteDemo(void); void PolyDemo(void); void SayGoodbye(void); void Pause(void); void MainWindow(char *header); void StatusLine(char *msg); void DrawBorder(void); void changetextstyle(int font, int direction, int charsize); int gprintf(int *xloc, int *yloc, char *fmt, ... ); /* */ /* Begin main function */ /* */ int main() { Initialize(); /* Set system into Graphics mode */ ReportStatus(); /* Report results of the initialization */ ColorDemo(); /* Begin actual demonstration */ if( GraphDriver==EGA || GraphDriver==EGALO || GraphDriver==VGA ) PaletteDemo(); PutPixelDemo(); PutImageDemo(); Bar3DDemo(); BarDemo(); RandomBars(); ArcDemo(); CircleDemo(); PieDemo(); LineRelDemo(); LineToDemo(); LineStyleDemo(); UserLineStyleDemo(); TextDump(); TextDemo(); CRTModeDemo(); FillStyleDemo(); FillPatternDemo(); PolyDemo(); SayGoodbye(); /* Give user the closing screen */ closegraph(); /* Return the system to text mode */ return(0); } /* */ /* INITIALIZE: Initializes the graphics system and reports */ /* any errors which occured. */ /* */ void Initialize(void) { int xasp, yasp; /* Used to read the aspect ratio*/ GraphDriver = DETECT; /* Request auto-detection */ initgraph( &GraphDriver, &GraphMode, "" ); ErrorCode = graphresult(); /* Read result of initialization*/ if( ErrorCode != grOk ){ /* Error occured during init */ printf(" Graphics System Error: %s\n", grapherrormsg( ErrorCode ) ); exit( 1 ); } getpalette( &palette ); /* Read the palette from board */ MaxColors = getmaxcolor() + 1; /* Read maximum number of colors*/ MaxX = getmaxx(); MaxY = getmaxy(); /* Read size of screen */ getaspectratio( &xasp, &yasp ); /* read the hardware aspect */ AspectRatio = (double)xasp / (double)yasp; /* Get correction factor */ } /* */ /* REPORTSTATUS: Report the current configuration of the system */ /* after the auto-detect initialization. */ /* */ void ReportStatus(void) { struct viewporttype viewinfo; /* Params for inquiry procedures*/ struct linesettingstype lineinfo; struct fillsettingstype fillinfo; struct textsettingstype textinfo; struct palettetype palette; char *driver, *mode; /* Strings for driver and mode */ int x, y; getviewsettings( &viewinfo ); getlinesettings( &lineinfo ); getfillsettings( &fillinfo ); gettextsettings( &textinfo ); getpalette( &palette ); x = 10; y = 4; MainWindow( "Status report after InitGraph" ); settextjustify( LEFT_TEXT, TOP_TEXT ); driver = getdrivername(); mode = getmodename(GraphMode); /* get current setting */ gprintf( &x, &y, "Graphics device : %-20s (%d)", driver, GraphDriver ); gprintf( &x, &y, "Graphics mode : %-20s (%d)", mode, GraphMode ); gprintf( &x, &y, "Screen resolution : ( 0, 0, %d, %d )", getmaxx(), getmaxy() ); gprintf( &x, &y, "Current view port : ( %d, %d, %d, %d )", viewinfo.left, viewinfo.top, viewinfo.right, viewinfo.bottom ); gprintf( &x, &y, "Clipping : %s", viewinfo.clip ? "ON" : "OFF" ); gprintf( &x, &y, "Current position : ( %d, %d )", getx(), gety() ); gprintf( &x, &y, "Colors available : %d", MaxColors ); gprintf( &x, &y, "Current color : %d", getcolor() ); gprintf( &x, &y, "Line style : %s", LineStyles[ lineinfo.linestyle ] ); gprintf( &x, &y, "Line thickness : %d", lineinfo.thickness ); gprintf( &x, &y, "Current fill style : %s", FillStyles[ fillinfo.pattern ] ); gprintf( &x, &y, "Current fill color : %d", fillinfo.color ); gprintf( &x, &y, "Current font : %s", Fonts[ textinfo.font ] ); gprintf( &x, &y, "Text direction : %s", TextDirect[ textinfo.direction ] ); gprintf( &x, &y, "Character size : %d", textinfo.charsize ); gprintf( &x, &y, "Horizontal justify : %s", HorizJust[ textinfo.horiz ] ); gprintf( &x, &y, "Vertical justify : %s", VertJust[ textinfo.vert ] ); Pause(); /* Pause for user to read screen*/ } /* */ /* TEXTDUMP: Display the all the characters in each of the */ /* available fonts. */ /* */ void TextDump() { static int CGASizes[] = { 1, 3, 7, 3, 3, 2, 2, 2, 2, 2, 2 }; static int NormSizes[] = { 1, 4, 7, 4, 4, 2, 2, 2, 2, 2, 2 }; char buffer[80]; int font, ch, wwidth, lwidth, size; struct viewporttype vp; for( font=0 ; font<NFONTS ; ++font ){ /* For each available font */ sprintf( buffer, "%s Character Set", Fonts[font] ); MainWindow( buffer ); /* Display fontname as banner */ getviewsettings( &vp ); /* read current viewport */ settextjustify( LEFT_TEXT, TOP_TEXT ); moveto( 2, 3 ); buffer[1] = '\0'; /* Terminate string */ wwidth = vp.right - vp.left; /* Determine the window width */ lwidth = textwidth( "H" ); /* Get average letter width */ if( font == DEFAULT_FONT ){ changetextstyle( font, HORIZ_DIR, 1 ); ch = 0; while( ch < 256 ){ /* For each possible character */ buffer[0] = ch; /* Put character into a string */ outtext( buffer ); /* send string to screen */ if( (getx() + lwidth) > wwidth ) moveto( 2, gety() + textheight("H") + 3 ); ++ch; /* Goto the next charact
评论
    相关推荐