資源簡(jiǎn)介
小巧的C#圍棋程序,可以計(jì)算圍棋領(lǐng)先子數(shù),功能比較全。
主要學(xué)習(xí)其界面開發(fā)技術(shù)

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Drawing;
using?System.IO;
using?ChessBlock?=?System.Collections.ArrayList;
namespace?go
{
????public?class?Board
????{
????????private?static?int?margin_top?=?50;
????????private?static?int?margin_left?=?20;
????????private?static?int?gap?=?20;
????????private?static?int?chessSize?=?8;
????????private?static?int?numberSize?=?6;
????????private?static?int?starSize?=?3;
????????private?Chess[]?m_Board?=?new?Chess[19?19];
????????private?BoardRecorder?m_recorder;
????????private?Chess?m_LastChess;
????????private?Chess?m_LastSingleChessEatten;
????????private?int?m_currentStep;
????????private?bool?m_bShowIndex?=?false;
????????public?Board()
????????{
????????????clear();
????????????//?For?Test
????????????//?bool?bSuccess?=?loadBoardFromFile(“init.txt“);
????????}
????????public?Chess?lastChess?{?get?{?return?m_LastChess;?}?}
????????public?bool?showIndex
????????{
????????????get?{?return?m_bShowIndex;?}
????????????set?{?m_bShowIndex?=?value;?}
????????}
????????public?Chess.POS?mapPointsToBoard(int?pointX?int?pointY)
????????{
????????????Chess.POS?pos;
????????????pos.posX?=?(pointX?-?margin_left?+?gap/2)?/?gap;
????????????pos.posY?=?(pointY?-?margin_top?+?gap/2)?/?gap;
????????????if?(!pos.isValid)
????????????????pos.setToInvalid();
????????????return?pos;
????????}
????????public?void?draw(Graphics?g)
????????{
????????????drawBorder(g);
????????????drawChess(g);
????????}
????????public?bool?addChess(Chess.POS?pos?Chess.ChessType?type)
????????{
????????????if?(type?!=?Chess.ChessType.Black?&&?type?!=?Chess.ChessType.White)
????????????????return?false;
????????????//?we?can?only?put?chess?on?empty?cells
????????????if?(m_Board[pos.posX?pos.posY].type?!=?Chess.ChessType.Empty)
????????????????return?false;
????????????//?put?the?chess?on?the?board?first
????????????m_Board[pos.posX?pos.posY].type?=?type;
????????????//?can?we?eat?others?
????????????bool?bEat?=?false;
????????????bool?bValidStep?=?true;
????????????if?(pos.hasLeft?&&?m_Board[pos.posX?-?1?pos.posY].type?==?Chess.oppsiteType(type))
????????????{
????????????????bEat?=?tryToEat(pos?new?Chess.POS(pos.posX?-?1?pos.posY)?ref?bValidStep)?||?bEat;
????????????????if?(!bValidStep)
????????????????????return?false;
????????????}
????????????if?(pos.hasRight?&&?m_Board[pos.posX?+?1?pos.posY].type?==?Chess.oppsiteType(type))
????????????{
????????????????bEat?=?tryToEat(pos?new?Chess.POS(pos.posX?+?1?pos.posY)?ref?bValidStep)?||?bEat;
????????????????if?(!bValidStep)
????????????????????return?false;
????????????}
????????????if?(pos.hasUp?&&?m_Board[pos.posX?pos.posY?-?1].type?==?Chess.oppsiteType(type))
????????????{
????????????????bEat?=?tryToEat(pos?new?Chess.POS(pos.posX?pos.posY?-?1)?ref?bValidStep)?||?bEat;
????????????????if?(!bValidStep)
????????????????????return?false;
??
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????????69??2013-03-27?21:58??圍棋程序C#\go\app.config
?????文件?????????69??2013-03-27?21:58??圍棋程序C#\go\bin\Debug\go.exe.config
?????文件??????11608??2013-03-27?21:59??圍棋程序C#\go\bin\Debug\go.vshost.exe
?????文件?????????69??2013-03-27?21:58??圍棋程序C#\go\bin\Debug\go.vshost.exe.config
?????文件??????31272??2009-02-01?16:11??圍棋程序C#\go\Board.cs
?????文件???????1747??2009-02-01?16:11??圍棋程序C#\go\BoardRecorder.cs
?????文件???????3938??2009-02-01?16:11??圍棋程序C#\go\Chess.cs
?????文件???????4236??2013-03-27?21:58??圍棋程序C#\go\go.csproj
?????文件???????1078??2009-02-01?16:10??圍棋程序C#\go\go.ico
?????文件???????9524??2009-02-01?16:11??圍棋程序C#\go\MainForm.cs
?????文件??????21288??2009-01-22?17:37??圍棋程序C#\go\MainForm.Designer.cs
?????文件???????6015??2009-01-22?17:37??圍棋程序C#\go\MainForm.resx
?????文件???????5372??2013-03-27?22:01??圍棋程序C#\go\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件?????????58??2013-03-27?21:59??圍棋程序C#\go\obj\Debug\go.csproj.FileListAbsolute.txt
?????文件???????4608??2013-03-27?21:58??圍棋程序C#\go\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件????????477??2009-02-01?16:11??圍棋程序C#\go\Program.cs
?????文件???????1398??2009-01-19?16:27??圍棋程序C#\go\Properties\AssemblyInfo.cs
?????文件???????2842??2013-03-27?21:58??圍棋程序C#\go\Properties\Resources.Designer.cs
?????文件???????5612??2009-01-16?16:23??圍棋程序C#\go\Properties\Resources.resx
?????文件???????1100??2013-03-27?21:58??圍棋程序C#\go\Properties\Settings.Designer.cs
?????文件????????249??2009-01-16?16:23??圍棋程序C#\go\Properties\Settings.settings
?????文件????????364??2009-02-01?16:11??圍棋程序C#\go\Utils.cs
?????文件??????31232??2009-02-01?16:11??圍棋程序C#\go.exe
?????文件????????896??2013-03-27?21:58??圍棋程序C#\go.sln
????..A..H.?????41984??2013-03-27?22:01??圍棋程序C#\go.suo
?????文件???????1654??2013-03-27?21:58??圍棋程序C#\UpgradeLog.xm
?????文件???????3348??2013-03-27?21:58??圍棋程序C#\_UpgradeReport_Files\UpgradeReport.css
?????文件??????12505??2010-05-04?01:19??圍棋程序C#\_UpgradeReport_Files\UpgradeReport.xslt
?????文件?????????69??2013-03-27?21:58??圍棋程序C#\_UpgradeReport_Files\UpgradeReport_Minus.gif
?????文件?????????71??2013-03-27?21:58??圍棋程序C#\_UpgradeReport_Files\UpgradeReport_Plus.gif
............此處省略13個(gè)文件信息
評(píng)論
共有 條評(píng)論