Skip to content

marcgardent/igoenchi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

The project is fork of IGoEnchi

IGoEnchi is an Internet Go Server (IGS) client and SGF editor for Windows Mobile. For more information please visit IGoEnchi homepage at https://sourceforge.net/projects/igoenchi/

Purpose of fork

  • Migrate to github
  • Compile under Visual Studio with last DotNet Framework
  • Separate of concern and make reusable lib and publish NuGet package.
    • IGOEnchi.GoGameSgf
      • IGOEnchi.SmartGameLib
      • IGOEnchi.GoGameLogic

IGOEnchi.GoGameSgf Library

Library to read/write gogames with Sgf-files. It's use IGOEnchi.SmartGameLib, IGOEnchi.GoGameLogic.

Usage

Open gogame from SGF

    private static GoGame OpenFile(string path)
    {
        using (var stream = File.OpenRead(path))
        {
            var excepted = SgfReader.LoadFromStream(stream);
            return SgfCompiler.Compile(excepted);
        }
    }

Save gogame to SGF

	private static void SaveAsSgf(GoGame gogame, string path)
    {
        var builder = new GoSgfBuilder(gogame);
        var sgf = builder.ToSGFTree();

        using (var file = File.CreateText(path))
        {
            var writer = new SgfWriter(file, true);
            writer.WriteSgfTree(sgf);
        }
    }

IGOEnchi.SmartGameLib Library

Independant library to read/write Sgf-files https://en.wikipedia.org/wiki/Smart_Game_Format

Usage

Read SGF

SGFTree excepted = SgfReader.LoadFromStream(stream);

See also

  • For Advanded usage to consume SGFTree see IGOEnchi.GoGameSgf.SgfCompiler Class

Create and Write SGF with SgfBuilder

	//Build
    var b = new SgfBuilder();
    b.p("b", "M1")
        .Fork(x => x.p("b", "M2").Next().p("b", "M3"))
        .Fork(x => x.p("c", "M2").Next().p("c", "M3"));

	var sgf = b.ToSGFTree();

	//Save
    using (var file = File.CreateText(path))
    {
		var writer = new SgfWriter(file, true);
        writer.WriteSgfTree(sgf);
	}

See also

IGOEnchi.GoGameLogic Library

Independant library to manipulate gogame.

    private static void throughGogameSample(GoGame game)
    {
        game.ToStart();

        do
        {
            var move =game.CurrentNode as GoMoveNode;
                
            if (move!=null)
            {
                //your code
            }
        }
	while ( game.ToNextMove());

	}

To construct gogame see IGOEnchi.GoGameSgf.SgfCompiler Class

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published