Re: [NTG-context] Draw chess board
![](https://secure.gravatar.com/avatar/6114858d84b0f40cf715f12237ab67a1.jpg?s=120&d=mm&r=g)
On 6/6/07, Zhichu Chen wrote:
Hi
I've tried to write a test file which can only handle ;B[??], ;W[??], AB[??], AW[??] now, and I haven't added the interaction part. But it is a good start.
Any suggestions?
Wow - that's really, really impressive! You indeed started parsing the strings in plain TeX! I've changed your source slightly, to give you an idea of yet another approach: using TikZ. It's main advantage over metapost might be: - you can draw more fancy stones (see the example - that could be made configurable of course), although teoretically the same could be achived with slightly improved smooth shading mechanism in mptopdf macros - might be easier to backport to (La)TeX - I can imagine your module to be a new, really nice TikZ package/module (that could be used in other flavours of TeX) + some fancy ConTeXt additions (user interface, javascript, ...). The main difference is that you need to store all the variables in TeX, not in metapost, so that part should be rewritten as well (which I didn't do). But simply forget about my stupid comments about (La)TeX for and do it your way now. Mojca (I have some other comments, but it's too early to speak about them, since the module is not ready/complete yet.) On 5/24/07, Zhichu Chen wrote:
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
![](https://secure.gravatar.com/avatar/117a058bed6945e7fa1b40ff2f6e7aa7.jpg?s=120&d=mm&r=g)
Hi Mojca,
The stones are very very nice now, thank you for your hints.
Since I haven't used TikZ before, I have no idea how to handle these events.
I'll learn it later and rewrite my module to be more professional :)
All I'm thinking now is how to make each step a single symbol so that I
could use \fieldstack to demonstrate the game.
By the way, I modified my module to do some fieldstack thing, but it gets a
weird error. I have no idea what's the error about, it's fine when I'm using
MPdrawing environment but it can't output anything when I switch to buffer
and use \processMPbuffer.
On 6/10/07, Mojca Miklavec
On 6/6/07, Zhichu Chen wrote:
Hi
I've tried to write a test file which can only handle ;B[??], ;W[??], AB[??], AW[??] now, and I haven't added the interaction part. But it is a good start.
Any suggestions?
Wow - that's really, really impressive! You indeed started parsing the strings in plain TeX!
I've changed your source slightly, to give you an idea of yet another approach: using TikZ. It's main advantage over metapost might be: - you can draw more fancy stones (see the example - that could be made configurable of course), although teoretically the same could be achived with slightly improved smooth shading mechanism in mptopdf macros - might be easier to backport to (La)TeX - I can imagine your module to be a new, really nice TikZ package/module (that could be used in other flavours of TeX) + some fancy ConTeXt additions (user interface, javascript, ...).
The main difference is that you need to store all the variables in TeX, not in metapost, so that part should be rewritten as well (which I didn't do).
But simply forget about my stupid comments about (La)TeX for and do it your way now.
Mojca
(I have some other comments, but it's too early to speak about them, since the module is not ready/complete yet.)
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
On 5/24/07, Zhichu Chen wrote: 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
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@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 ----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/117a058bed6945e7fa1b40ff2f6e7aa7.jpg?s=120&d=mm&r=g)
Hi guys
I've modified my module again, then you can click to demostrate a game. The
source file is attached and the resulting pdf file is pretty huge so I just
upload to my google page (I think there's a bandwidth limitation so I use
winrar to compress it):
http://zhichu.chen.googlepages.com/sgfstack.rar
On 6/11/07, Zhichu Chen
Hi Mojca,
The stones are very very nice now, thank you for your hints.
Since I haven't used TikZ before, I have no idea how to handle these events. I'll learn it later and rewrite my module to be more professional :)
All I'm thinking now is how to make each step a single symbol so that I could use \fieldstack to demonstrate the game.
By the way, I modified my module to do some fieldstack thing, but it gets a weird error. I have no idea what's the error about, it's fine when I'm using MPdrawing environment but it can't output anything when I switch to buffer and use \processMPbuffer.
On 6/10/07, Mojca Miklavec
wrote: On 6/6/07, Zhichu Chen wrote:
Hi
I've tried to write a test file which can only handle ;B[??], ;W[??], AB[??], AW[??] now, and I haven't added the interaction part. But it is a good start.
Any suggestions?
Wow - that's really, really impressive! You indeed started parsing the strings in plain TeX!
I've changed your source slightly, to give you an idea of yet another approach: using TikZ. It's main advantage over metapost might be: - you can draw more fancy stones (see the example - that could be made configurable of course), although teoretically the same could be achived with slightly improved smooth shading mechanism in mptopdf macros - might be easier to backport to (La)TeX - I can imagine your module to be a new, really nice TikZ package/module (that could be used in other flavours of TeX) + some fancy ConTeXt additions (user interface, javascript, ...).
The main difference is that you need to store all the variables in TeX, not in metapost, so that part should be rewritten as well (which I didn't do).
But simply forget about my stupid comments about (La)TeX for and do it your way now.
Mojca
(I have some other comments, but it's too early to speak about them, since the module is not ready/complete yet.)
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
On 5/24/07, Zhichu Chen wrote: 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
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@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 ----------------------------------------------------------------
-- 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 ----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
2007/6/11, Zhichu Chen
Hi guys
I've modified my module again, then you can click to demostrate a game. The source file is attached and the resulting pdf file is pretty huge so I just upload to my google page (I think there's a bandwidth limitation so I use winrar to compress it): http://zhichu.chen.googlepages.com/sgfstack.rar
Hi Chen, nice module. One suggestion for your Todo list: size option for the board (goban): - small (9 x 9) - medium (13 x 13) - big (19 x 19), default size Wolfgang
![](https://secure.gravatar.com/avatar/117a058bed6945e7fa1b40ff2f6e7aa7.jpg?s=120&d=mm&r=g)
Hi Wolfgang,
Actually, the sgf file always contains strings like SZ[19] which indicates
the board size is 19x19, so I think if I wanna manually input a game, just
type SZ[??] will be more convenient.
The main problem is how to move dead stones from the board, this is not so
easy in tex or metapost. I looked at other sgf viewers, and still have no
idea.
Another problem is that the output file is very big (of course, because it
contains like hundreds of graphics), can I use some command like
\pdfcompresslevel to compress these graphics? The default value of
\pdfcompresslevel is 9 and the pdf output file is like 4M, when I use winrar
to compress it, it shrinked to less than 700k. So I think there should be
some way to compress it more.
On 6/11/07, Wolfgang Schuster
2007/6/11, Zhichu Chen
: Hi guys
I've modified my module again, then you can click to demostrate a game. The source file is attached and the resulting pdf file is pretty huge so I just upload to my google page (I think there's a bandwidth limitation so I use winrar to compress it): http://zhichu.chen.googlepages.com/sgfstack.rar
Hi Chen,
nice module. One suggestion for your Todo list:
size option for the board (goban): - small (9 x 9) - medium (13 x 13) - big (19 x 19), default size
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@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 ----------------------------------------------------------------
participants (3)
-
Mojca Miklavec
-
Wolfgang Schuster
-
Zhichu Chen