[NTG-context] Draw chess board

Mojca Miklavec mojca.miklavec.lists at gmail.com
Thu May 24 21:07:38 CEST 2007


On 5/24/07, Zhichu Chen wrote:
> Thanks Wolfgang
>
> The first link is very useful. I will took its idea. I really want to use
> metapost's scantoken to read sgf file directly, so it can easily be a
> cross-platform solution.

You can use either TeX or metapost to parse sgf file. But you can
forget about TeX, I suppose. Metapost is an option if you love
challenges, but it's not the only possibility if you're looking for
cross-platform solutions.

In http://match.stanford.edu/bump/sgf2dg-4.026.tar.gz you have
sgf2mpost.c with 1000 lines of pure C code which parses the file and
generates metapost output.

If I was in your place, I would write a ruby (or lua ;) parser (the
file above can help you, but you can probably parse the input in a
much more clever & efficient way with ruby) + metapost code generator.

Then you write a ConTeXt module with

\startSGFscript{name} or \startSGFfile or \startSGFgame or \startGOgame
.... the very special format of your game ...
\stopSGFscript

You write the content into a file (you can also prepare external files
and tell ConTeXt which one is the source file), call "texmfstart
your-great-ruby-script file.sgf", which generates metapost output, and
then you include that one in the ConTeXt document.

I'm really not sure if parsing SGF files with metapost can bring you
anything ... ruby scripts are fully portable, at least in ConTeXt.

Mojca


> On 5/24/07, Wolfgang Schuster
> <schuster.wolfgang at googlemail.com> wrote:
> > 2007/5/24, Zhichu Chen <zhichu.chen at gmail.com>:
> > > Hi
> > >
> > > I love chess games, especially one kind of them which is generally
> called
> > > Go.
> > >
> > > I know there is some file can store each details in one game:
> > > http://www.red-bean.com/sgf/
> > >
> > > AFAIK, there is no module available to draw chess in ConTeXt now. I
> wanna do
> > > this by using MetaPost and fieldstack. But I don't know how to tell
> metapost
> > > the details of the sgf file. Can anyone give me a suggestion?
> > >
> > > BTW, I don't like the name. It's invented by acient Chinese and it's
> called
> > > Weiqi. I think we can call it Siege Chess in English.
> > >
> > >
> > > --
> > > Best Regards
> > > Chen
> >
> > Hi Chen,
> >
> > if you mean Go take a look at the following page:
> >
> > http://match.stanford.edu/bump/go.html
> >
> > There are also two packages on CTAN for LaTeX:
> >
> >
> http://www.ctan.org/tex-archive/help/Catalogue/bytopic.html#gamesgo
> >
> > Wolfgang
> >
> ___________________________________________________________________________________
> > If your question is of interest to others as well, please add an entry to
> the Wiki!
> >
> > maillist : ntg-context at ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> > webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> > archive  :
> https://foundry.supelec.fr/projects/contextrev/
> > wiki     : http://contextgarden.net
> >
> ___________________________________________________________________________________
> >
>
>
>
> --
> Best Regards
> Chen
> ----------------------------------------------------------------
>
>           Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
>          No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
>              tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
>                                                |
> www.sinap.ac.cn
> ----------------------------------------------------------------
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context at ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>
>


More information about the ntg-context mailing list