软著申请源代码

上传人:小** 文档编号:93352186 上传时间:2019-07-20 格式:DOC 页数:90 大小:45.42KB
返回 下载 相关 举报
软著申请源代码_第1页
第1页 / 共90页
软著申请源代码_第2页
第2页 / 共90页
软著申请源代码_第3页
第3页 / 共90页
软著申请源代码_第4页
第4页 / 共90页
软著申请源代码_第5页
第5页 / 共90页
点击查看更多>>
资源描述

《软著申请源代码》由会员分享,可在线阅读,更多相关《软著申请源代码(90页珍藏版)》请在金锄头文库上搜索。

1、弈秋围棋游戏软件 V1.0 源代码 99前言 围棋不仅能增强思维能力,提高智力,而且富含哲理,有助于修身养性。同时它起源于中国,古称“弈”,是我国传统技艺之一。本游戏软件提供了人机对弈,和棋手对弈(局域网对弈)两种模式,局域网模式可以保证多人同时进行游戏。本软件使用C#语言编写,在windows 7 x64系统下采用Visual Studio 2010开发和调试,附源码如下。客户端程序:/-login.cs-/using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;u

2、sing System.Drawing;using System.Text;using System.Windows.Forms;namespace go public partial class Login : Form public Login() InitializeComponent(); /人机对弈 private void button1_Click(object sender, EventArgs e) this.Hide(); Playing playing = new Playing(); playing.ShowDialog(); this.Show(); /局域网对弈 p

3、rivate void button2_Click(object sender,EventArgs e) this.Hide(); FormRoom formroom = new FormRoom(); formroom.ShowDialog(); this.Show(); private void button3_Click(object sender, EventArgs e) Application.Exit(); private void button3_MouseEnter(object sender, EventArgs e) Button btn = (Button)sender

4、; btn.ForeColor = Color.Black; btn.BackColor = Color.White; private void button3_MouseLeave(object sender, EventArgs e) Button btn = (Button)sender; btn.ForeColor = Color.White; btn.BackColor = Color.Black; /-Playing.cs-/using System;using System.Collections.Generic;using System.ComponentModel;using

5、 System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace go public partial class Playing : Form delegate void SetTextCallback(string text); private enum Status NotStarted = 0, InGame = 1, RemoveDead = 2, FillEmpty = 3, Ended = 4 private System.Threading.Thread pc_play

6、; private Board m_board = new Board(); private Chess.ChessType m_turn = Chess.ChessType.Black; private int m_secondsBlack = 0; private int m_secondsWhite = 0; private Timer m_timer = new Timer(); private Status m_status = Status.NotStarted; public Chess.ChessType turn get return m_turn; set m_turn =

7、 value; this.SetTurn(m_turn.ToString() = Black) ? 黑方 : 白方); public Playing() InitializeComponent(); float h = this.Size.Height - 10; float w = this.Size.Width - 140; m_board.ReSize(0, 0, w, h); m_timer.Interval = 1000; m_timer.Tick += new EventHandler(timer_Tick); TimeSpan tm = new TimeSpan(0, 0, 0)

8、; labelTimeBlack.Text = tm.ToString(); labelTimeWhite.Text = tm.ToString(); labelTurn.Text = 黑方; private void SetTurn(string text) if (this.labelTurn.InvokeRequired) SetTextCallback d = new SetTextCallback(SetTurn); this.Invoke(d, new object text ); else this.labelTurn.Text = text; /计时功能 private voi

9、d timer_Tick(object sender, EventArgs e) if (turn = Chess.ChessType.Black) m_secondsBlack+; TimeSpan tm = new TimeSpan(0, 0, m_secondsBlack); labelTimeBlack.Text = tm.ToString(); else if (turn = Chess.ChessType.White) m_secondsWhite+; TimeSpan tm = new TimeSpan(0, 0, m_secondsWhite); labelTimeWhite.

10、Text = tm.ToString(); if (pc_play != null & !pc_play.IsAlive) pc_play.Abort(); pc_play.Join(); pc_play = null; private void OnFormClicked(object sender, EventArgs e) /棋局结束 if (m_board.isGameOver) this.buttonCalculate_Click(null, null); m_board.isGameOver = false; return; /不是轮到黑子的时候禁止下棋 if (!m_board.single | turn = Chess.ChessType.White) return; /备份棋局 this.m_board.BackupChess(); MouseEventArgs args = e as MouseEventArgs; if (arg

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业/管理/HR > 管理学资料

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号