g2o20160430下的csparse文件夹内的CMakeLists.txt

图片 8

图片 1

  1. g2o20160430下的csparse文件夹内的CMakeLists.txt

    cmake_minimum_required(VERSION 2.6)

    PROJECT(csparse)

    SET(CMAKE_C_FLAGS_RELEASE “-O3 -DNDEBUG”)
    #设置 G2O_LGPL_LIB_TYPE STATIC如果想创建静态的csparse库

    ADD_LIBRARY(csparse ${G2O_LGPL_LIB_TYPE} cs_add.c cs_amd.c cs_chol.c cs_cholsol.c cs_compress.c cs_counts.c cs_cumsum.c cs_dfs.c cs_dmperm.c cs_droptol.c cs_dropzeros.c
    cs_dupl.c cs_entry.c cs_ereach.c cs_etree.c cs_fkeep.c cs_gaxpy.c cs_happly.c cs_house.c cs_ipvec.c cs_leaf.c cs_load.c cs_lsolve.c cs_ltsolve.c cs_lu.c cs_lusol.c
    cs_malloc.c cs_maxtrans.c cs_multiply.c cs_norm.c cs_permute.c cs_pinv.c cs_post.c cs_print.c cs_pvec.c cs_qr.c cs_qrsol.c cs_randperm.c cs_reach.c cs_scatter.c cs_scc.c
    cs_schol.c cs_spsolve.c cs_sqr.c cs_symperm.c cs_tdfs.c cs_transpose.c cs_updown.c cs_usolve.c cs_util.c cs_utsolve.c cs_api.h )

    SET_TARGET_PROPERTIES(csparse PROPERTIES OUTPUT_NAME ${LIB_PREFIX}ext_csparse)
    IF (UNIX)
    TARGET_LINK_LIBRARIES(csparse m)
    ENDIF()
    #输出路径
    INSTALL(TARGETS csparse
      RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
      LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
      ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )
    #安装路径
    FILE(GLOB headers “${CMAKE_CURRENT_SOURCE_DIR}/.h” “${CMAKE_CURRENT_SOURCE_DIR}/.hpp”)
    INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/EXTERNAL/csparse)

    # Set up the variables
    SET(CSPARSE_LIBRARY “$”)
    SET(CSPARSE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH “Include directory for CSparse” FORCE)
    SET(CSPARSE_LIBRARY ${CSPARSE_LIBRARY} CACHE FILEPATH “CSparse library” FORCE)

    #SET(CSPARSE_FOUND TRUE PARENT_SCOPE)
    #MESSAGE(“CSPARSE_LIBRARY = ${CSPARSE_LIBRARY}”)
    #MESSAGE(“CSPARSE_INCLUDE_DIR = ${CSPARSE_INCLUDE_DIR}”)

以前写的中国象棋引擎的C#源程序,可在VS2010中编译运行,由于个人精力有限,难以完成后续的开发工作,如果谁感兴趣,请关注微信公众号(“申龙斌的程序人生”,ID:slbGTD),发送后台消息“象棋引擎”,可收到源代码和相关资料的下载链接。并请告诉我你的姓名,并且如果你修改代码后参加比赛请加上我的名字就行了。

图片 2图片 3

 

当前完成的工作:

using System.Collections.Generic;
namespace Chart
{
    public class Program
    {
        static void Main(string[] args)
        {
            Chart chart = new Chart();
            ChartType chartType = ChartType.Histogram;
            string path = @"....JSON.json";
            DataSource dataSource = new JsonDataSource();
            List<Composition> Compositions = dataSource.GetDataList(path);
            chart.Compositions.AddRange(Compositions);
            chart.Draw(chartType);
            chart.Save();
        }
    }
}

1)着法生成

Program.cs

2)简单的alphabeta算法,支持置换表

 

3)可以读取一堆PGN文件,生成开局库

图片 4图片 5

4)解析ucci命令

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
namespace Chart
{
    public class Chart
    {
        private Bitmap bmp = new Bitmap(600, 600);
        List<Composition> composition = new List<Composition>();
        public List<Composition> Compositions { get { return composition; } }
        private float width;

        private float Width
        {
            get
            {
                int sum = 0;
                foreach (var composition in Compositions)
                {
                    sum += composition.DataPoints.Count + 1;
                }
                width = (float)420 / sum;
                return width;
            }
        }

        public void Draw(ChartType chartType)
        {
            Series series;

            switch (chartType)
            {
                case ChartType.LineChart:
                    series = new LineSeries();
                    break;

                case ChartType.Histogram:
                    series = new HistogramSeries();
                    break;

                case ChartType.PieChart:
                    series = new PieSeries();
                    break;

                default:
                    throw new ArgumentOutOfRangeException("Nonexistent ChartType!");
            }

            foreach (var comPosition in Compositions)
            {
                series.Legend.Add(comPosition.Name);
            }

            Platform platform = new Windows(bmp);

            series.Draw(Width, platform, Compositions);
        }

        public void Save()
        {
            bmp.Save(@"....1.bmp");
            Process.Start(@"....1.bmp");
        }
    }
}

5)有一个对战测试程序

Chart.cs

6)基本的单元测试

图片 6图片 7

程序当前全部是托管代码,还没有考虑性能优化。

using System.Collections;
using System.Collections.Generic;
using System.Drawing;
namespace Chart
{
    public abstract class Series
    {
        ArrayList legend = new ArrayList();
        public ArrayList Legend { get { return legend; } set { } }

        protected PointF PointFormLarge;
        protected PointF PointFormSmall;

        private void DrawChart(Platform g)
        {
            g.FillRectangle(g.WBrush, 20, 20, 580, 500);
        }

        protected abstract void DrawCore(float width, Platform g, List<Composition> Compositions);

        public void Draw(float width, Platform g, List<Composition> Compositions)
        {
            PointFormLarge = new PointF(width * Compositions.Count + width, 0);
            PointFormSmall = new PointF(width, 0);
            DrawChart(g);
            DrawCore(width, g, Compositions);
        }
    }
}

图片 8

Series.cs

整个源代码可以编译,有些文件有重复,以源代码中的工程文件的为准。

图片 9图片 10

除了源代码之外,还有收集到的一些相关论文可以一起提供。

using System.Collections.Generic;
using System.Drawing;
using System;
namespace Chart
{
    public class HistogramSeries : Series
    {

        private void DrawAxes(Platform g)
        {
            g.DrawLine(g.Rpen, new Point(100, 40), new Point(100, 420));
            g.DrawLine(g.Rpen, new Point(100, 40), new Point(90, 50));
            g.DrawLine(g.Rpen, new Point(100, 40), new Point(110, 50));
            g.DrawLine(g.Rpen, new Point(100, 420), new Point(570, 420));
            g.DrawLine(g.Rpen, new Point(570, 420), new Point(560, 410));
            g.DrawLine(g.Rpen, new Point(570, 420), new Point(560, 430));

            g.DrawString("月考成绩", g.LargeFont, g.Bbrush, new RectangleF(300, 30, 170, 50));
            g.DrawString("科目", g.LargeFont, g.Bbrush, new RectangleF(530, 450, 100, 40));
            g.DrawString("成绩", g.LargeFont, g.Bbrush, new RectangleF(40, 30, 40, 40));

            for (int i = 0; i < 5; i++)
            {
                g.DrawLine(g.BlackPen, new Point(100, 60 + 72 * i), new Point(570, 60 + 72 * i));
            }
        }

        private void DrawLegend(Platform g)
        {
            int LegendWidth = 250 / (Legend.Count - 1);
            int StringX = 50;
            int LegendX = StringX + 60;
            int k = 0;
            foreach (string legend in Legend)
            {
                switch (k)
                {
                    case 0:
                        g.Brush = Brushes.Blue;
                        break;
                    case 1:
                        g.Brush = Brushes.Red;
                        break;
                    case 2:
                        g.Brush = Brushes.Yellow;
                        break;
                    case 3:
                        g.Brush = Brushes.Green;
                        break;
                }
                g.DrawString(legend, g.LargeFont, Brushes.Blue, StringX, 480);
                Rectangle rect = new Rectangle(LegendX, 480, LegendWidth * 2 / 3, 20);
                g.FillRectangle(g.Brush, rect);

                StringX += 550 / Legend.Count;
                LegendX = StringX + 60;
                k++;
            }
        }



        protected override void DrawCore(float width, Platform g, List<Composition> Compositions)
        {
            DrawAxes(g);
            DrawLegend(g);
            foreach (var datapoint in Compositions[0].DataPoints)
            {
                g.DrawString(datapoint.XValue, g.LargeFont, g.Bbrush, 120, 430);
                g.TranslateTransform(PointFormLarge.X, PointFormLarge.Y);
            }
            g.ResetTransform();

            int YValueMax = 0;
            foreach (var composition in Compositions)
            {
                if (YValueMax <= composition.Max)
                {
                    YValueMax = composition.Max;
                }
            }

            g.YRatioScale = 370 / YValueMax;


            for (int i = 0; i <= 5; i++)
            {
                g.DrawString(Math.Ceiling(360/5/ g.YRatioScale*(5-i)).ToString(), g.LargeFont, g.BlackBrush, new RectangleF(80, 50 + 72 * i, 50, 50));
            }




            void DrawRectangle(float x, float y, float Width, float height, Composition composition)
            {
                Rectangle rect = new Rectangle((int)x, (int)y, (int)width, (int)height);
                g.FillRectangle(composition.BrushColor, rect);
            }
            int j = 1;
            foreach (var composition in Compositions)
            {
                Compositions[0].BrushColor = Brushes.Blue;
                Compositions[1].BrushColor = Brushes.Red;
                Compositions[2].BrushColor = Brushes.Yellow;
                foreach (var datapoint in composition.DataPoints)
                {
                    DrawRectangle(120, 420 - datapoint.YValue * g.YRatioScale, width, datapoint.YValue * g.YRatioScale, composition);
                    g.DrawString(datapoint.YValue.ToString(), g.SmallFont, Brushes.Red, 120, 420 - datapoint.YValue * g.YRatioScale - 15);
                    g.TranslateTransform(PointFormLarge.X, PointFormLarge.Y);
                }
                g.ResetTransform();
                for (int i = 0; i < j; i++)
                {
                    g.TranslateTransform(PointFormSmall.X, PointFormSmall.Y);
                }
                j++;
            }
            g.ResetTransform();
        }
    }
}

PonderNet
│  PonderNet.sln
├─BitBoardBase   本来是想用位棋盘的,后来看来一篇论文(2009.Reul.New
Architectures in Computer Chess),改用17×14的数组表示法
│    BitHack64.cs
│    Board.cs
│    BoardUtil.cs
│    Board_Const.cs
│    Board_Makemove.cs
│    Fen.cs
│    Move.cs
│    MoveGenerator.cs
│    MoveGenerator_Preset.cs
│    MoveNotation.cs
│    PgnUtil.cs
│    RandomMersenneTwister.cs
│    TraceAndTestImpact.testsettings
│    Zobrist.cs
│         
├─Perft    用来验证着法程序生成的工具
│    Program.cs
│         
├─Ponder.OpeningBook   用来生成开局库的工具
│    Program.cs
│         
├─PonderEngine  引擎
│    Evaluator.cs
│    MoveGenerator.cs
│    MoveGenerator_Preset.cs
│    OpeningBook.cs
│    PonderEngine.cs
│    PonderMain.cs
│    SearchTT.cs
│    SimpleSearch.cs
│    TranspositionTable.cs
│    UcciCommand.cs   能够识别一些简单的ucci命令
│   
│         
├─PonderGame   用于与其它引擎对战的程序,也可以自己与自己对战
│   Engine.cs
│   EngineProcess.cs
│   ExeProcess.cs
│   PonderGame.cs
│   PonderGameMain.cs
│   Settings.cs
│         
├─TestBitBoardBase  单元测试,主要针对着法生成
│    BoardTest.cs
│    MoveGeneratorTest.cs
│    TestBitBoardBase.csproj
│    TestChineseChess.csproj
│         
└─TestPonderEngine  单元测试,主要针对引擎的alphabeta搜索算法
      MoveGeneratorTest.cs
      PonderEngineTest.cs
      SimpleSearchTest.cs
      TestPonderEngine.csproj
      UnitTest_SearchTT.cs

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图