- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
黑白棋c程序(Othello C program)
黑白棋c程序(Othello C program)
# include graphics.h 图形系统头文件 / * * /
# define left 0x4b00 光标左键值 / * * /
# define right 0x4d00 光标右键值 / * * /
# define down 0x5000 光标下键值 / * * /
# define the ip 0x4800 光标上键值 / * * /
# define esc 0x011b esc键值 / * * /
# define enter 0x1c0d 回车键值 / * * /
int a [8] [8] = {0}, key, score1, score2 具体分数以及按键与存放棋子的变量; / * * /
char playone [3], playtwo [3]; / * 两个人的得分转换成字符串输出 * /
playtoplay void (void); / * 人人对战函数 * /
drawqp void (void); / * 画棋盘函数 * /
void setplaycolor (int x); / * 设置棋子第一次的颜色 * /
void movecolor (int x, int y); / * 恢复原来棋盘状态 * /
int qpchange (int x, int y, int z); / * 判断棋盘的变化 * /
doscore void (void); / * 处理分数 * /
void printscore (int n); / * 输出成绩 * /
playwin void (void); / * 输出胜利者信息 * /
/ * * * * * * 主函数 * * * * * * * * * /
void main (void)
{
int dg = detect, gr;
initgraph ( dg, gr, c: \ ^ tc); / * 初始化图形系统 * /
drawqp (); / * 画棋盘 * /
playtoplay (); / * 人人对战 * /
getch ();
closegraph (); / * 关闭图形系统 * /
}
void drawqp () / * 画棋盘 * /
{
int i, j;
score1 = score2 = 0; / * 棋手一开始得分都为0 * /
setbkcolor (blue);
for (i = 100; in = 420; + = 40)
{
line (100, in 420, in 画水平线); / * * /
line (in 100, 420); / * 画垂直线 * /
}
setcolor (0); / * 取消圆周围的一圈东西 * /
setfillstyle (solid _ fill, 15); / * 白色实体填充模式 * /
fillellipse (500200,15,15); / * 在显示得分的位置画棋 * /
setfillstyle (solid _ fill, 8); / * 黑色实体填充模式 * /
fillellipse (500300,15,15);
a [3] [3] = a [4] [4] = 1; / * 初始两个黑棋 * /
a [3] [4] = a [4] [3] = 2; / * 初始两个白棋 * /
setfillstyle (solid _ fill, white);
fillellipse (120 + 3 * a + 3 * 40,15,15);
fillellipse (120 + 4 * a + 4 * 40,15,15);
setfillstyle (solid _ fill, 8);
fillellipse (120 + 3 * a + 4 * 40,15,15);
fillellipse (120 + 4 * a + 3 * 40,15,15);
score1 = score2 = 2; / * 有棋后改变分数 * /
doscore (); / * 输出开始分数 * /
}
void playtoplay () / * 人人对战 * /
{
int x, y, t = 1, i, j, cc = 0;
while (1) / * 换棋手走棋 * /
{
x = 120, y = 80; / * 每次棋子一开始出来的坐标, x为行坐标, y为列坐标 * /
while (1) / * 具体一个棋手走棋的过程 * /
{
printscore (1); / * 输出棋手1的成绩 * /
printscore (2); / * 输出棋手2的成绩 * /
setplaycolor (t);
您可能关注的文档
- 急速看盘攻略(Rapid Kanpan Raiders).doc
- 戢武王有感(There is a sense of Wang Ji).doc
- 户外求生宝盒(Outdoor survival kit).doc
- 技师论文合理营养是促进健康的重要手段(Technician's thesis reasonable nutrition is an important means to promote health).doc
- 技术创新十大误区(Ten misunderstandings of technological innovation).doc
- 技术创新的博弈分析(Game analysis of technological innovation).doc
- 护理管理学第3章(Nursing management, third chapters).doc
- 挂职干部练硬功(Cadres training skills).doc
- 拒马河(Juma River).doc
- 户外领队职责(Outdoor Leader responsibilities).doc
- 黄金投资途径(Gold investment approach).doc
- 一朝天子一朝臣 现象企业如何应对(How to deal with sovereign phenomenon of enterprises).doc
- 中国式企管的整合与中国式管理的反思(Reflection on Chinese style management and integrated Chinese management).doc
- 真功夫--前可口可乐全球营销总监的品牌营销之道(Kung Fu - the brand marketing of the former Coca-Cola global marketing director).doc
- 网络学习指导-在线作业c(Online learning guide - online homework, C).doc
- 网络招聘——超越同质化竞争(Network recruitment -- beyond homogenization competition).doc
- 芝华士风波一场传媒与品牌的博弈(Chivas storm a game between media and brand).doc
- 网络推广之电子邮件推广方案(Email promotion program for web promotion).doc
- 英雄崇拜与品牌崇拜(Hero worship and brand worship).doc
- 周大福继承人郑志刚完美男人出炉记(Zhou Dafu heir Zheng Zhigang the perfect man).doc
文档评论(0)