资源简介
围棋棋局截屏或者图片的自动识别,然后可以进行试棋或形势判断
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Data;
using System.Drawing;
namespace GoChess
{
public class GoChessboard
{
public GoChessboard()
{
dt_chessorder = new DataTable();
dt_chessorder.Columns.Add(“Order“ typeof(int));
dt_chessorder.Columns.Add(“Point“ typeof(Point));
dt_chessorder.Columns.Add(“ChessMode“ typeof(ChessMode));
p_last = new Point(-1 -1);
chessboard_start = new List();
chessboard = new List();
for (int i = 0; i < 19;i++ )
{
for (int j = 0; j < 19; j++)
{
GoChessPoint gcp = new GoChessPoint(i j ChessMode.None);
chessboard_start.Add(gcp);
chessboard.Add(gcp);
}
}
}
public event ChessEventHandler AddChessEvent;
public event ChessEventHandler TakedChessEvent;
public delegate void ChessEventHandler(ChessEventArgs e);
protected virtual void OnAddChessEvent(ChessEventArgs e)
{
if(AddChessEvent != null)
AddChessEvent(e);
}
protected virtual void OnTakedChessEvent(ChessEventArgs e)
{
if (TakedChessEvent != null)
TakedChessEvent(e);
}
List chessboard;
List chessboard_start;
DataTable dt_chessorder;
int nowCount = 0; //从0开始
Point p_last;
public int NowCount
{
get { return nowCount; }
}
public Point P_Last
{
get { return p_last; }
}
public bool AddChessPoint(Point pint addmode)
{
return AddChessPoint(p.X p.Y addmode);
}
public bool AddChessPoint(int x int y int addmode)
{
if (nowCount % 2 == 0)
{
return AddChessPoint(x y addmode ChessMode.Black);
}
else
{
return AddChessPoint(x y addmode ChessMode.White);
}
}
public bool AddChessPoint(Point p int addmode ChessMode cmode)
{
return AddChessPoint(p.X p.Y addmode cmode);
}
public bool AddChessPoint(int x int y int addmode ChessMode cmode) //addmode: 0:正常落子 1:识别落子 2:试下落子
{
if(x == -1&& y == -1&& addmode == 0)
{
AddOrder(x y cmode);
return true;
}
int pos = x * 19 + y;
if (chessboard[pos].GoChestMode == ChessMode.None)
{
if(addmode != 1)
{
GoChessPoint gcp = chessboard[pos];
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 32768 2010-08-05 11:24 GoChess\GoChess\bin\Debug\GoChess.dll
文件 60928 2010-08-05 11:24 GoChess\GoChess\bin\Debug\GoChess.pdb
文件 2734 2010-10-08 09:40 GoChess\GoChess\GoChess.csproj
文件 11859 2010-08-04 17:05 GoChess\GoChess\GoChessboard.cs
文件 13712 2010-07-02 11:13 GoChess\GoChess\GoChessboardRecg.cs
文件 12454 2010-08-05 11:24 GoChess\GoChess\GoChessControl.cs
文件 1391 2010-06-11 11:03 GoChess\GoChess\GoChessControl.Designer.cs
文件 5814 2010-06-11 11:10 GoChess\GoChess\GoChessControl.resx
文件 994 2010-06-10 16:14 GoChess\GoChess\GoChessPoint.cs
文件 778 2010-08-04 17:08 GoChess\GoChess\obj\Debug\GoChess.csproj.GenerateResource.Cache
文件 32768 2010-08-05 11:24 GoChess\GoChess\obj\Debug\GoChess.dll
文件 180 2010-08-04 17:08 GoChess\GoChess\obj\Debug\GoChess.GoChessControl.resources
文件 60928 2010-08-05 11:24 GoChess\GoChess\obj\Debug\GoChess.pdb
文件 20480 2010-08-04 17:02 GoChess\GoChess\obj\Debug\Refactor\GoChess.dll
文件 1374 2010-09-21 11:04 GoChess\GoChess\obj\GoChess.csproj.FileListAbsolute.txt
文件 1317 2010-06-01 14:51 GoChess\GoChess\Properties\AssemblyInfo.cs
文件 1864 2010-10-08 09:40 GoChess\GoChess.sln
..A..H. 32256 2011-03-10 15:52 GoChess\GoChess.suo
文件 188 2010-06-21 14:13 GoChess\GoChessAI\AIob
文件 16384 2010-08-04 17:08 GoChess\GoChessAI\bin\Debug\GoChessAI.dll
文件 13824 2010-08-04 17:08 GoChess\GoChessAI\bin\Debug\GoChessAI.pdb
文件 620 2010-08-04 15:48 GoChess\GoChessAI\Brain.cs
文件 1967 2010-08-04 16:41 GoChess\GoChessAI\Eye.cs
文件 2335 2010-10-08 09:40 GoChess\GoChessAI\GoChessAI.csproj
文件 16384 2010-08-04 17:08 GoChess\GoChessAI\obj\Debug\GoChessAI.dll
文件 13824 2010-08-04 17:08 GoChess\GoChessAI\obj\Debug\GoChessAI.pdb
文件 951 2010-09-21 11:04 GoChess\GoChessAI\obj\GoChessAI.csproj.FileListAbsolute.txt
文件 1321 2010-06-11 09:37 GoChess\GoChessAI\Properties\AssemblyInfo.cs
文件 139 2010-06-21 13:52 GoChess\GoChessAI\ReadAndWrite.cs
文件 3072054 2010-06-11 21:00 GoChess\GoTest\bin\Debug\1.bmp
............此处省略50个文件信息
评论
共有 条评论