Re: visualizing chess

Discussion in 'Perl Misc' started by Ben Bacarisse, Aug 21, 2013.

  1. Eli the Bearded <*@eli.users.panix.com> writes:

    > use Chess::Rep; # turn move seq. into a FEN
    > use Games::Chess; # turn a FEN into a GIF
    > use GD; # GIF library
    >
    > my $game = Chess::Rep->new;
    >
    > while(my $halfmove = sub_to_get_halfmove()) {
    >
    > # a halfmove looks like "Bf4" or "O-O"
    > $game->go_move($halfmove);
    >
    > if(show_this_board()) {
    >
    > my $fen = $game->get_fen;
    > my $board = Games::Chess::position->new($fen);
    > do_something_with_gif($board->to_GIF());
    >
    > }
    > }
    >
    >
    > That basically works. Chess::Rep is fairly recent (2007), Games::Chess
    > is very old (1999), but both are pure perl and work fine with my
    > v5.14.2. My big complaint is that Games::Chess' to_GIF() hardcodes a
    > lot of things, like colors and sizes. (And output image format.)
    >
    > Any other suggestions for drawing chessboards besides "roll my own"?
    > Shelling out to other open source Unix programs is acceptable, but
    > not optiminal.
    >
    > Elijah
    > ------
    > will roll his own with HTML output if that's what's needed


    Maybe not "needed" but it's probably quite easy if using Unicode chess
    symbols is acceptable. I think they are quite well supported. Colours,
    patterns on squares, borders etc can then all be done with some simple
    CSS.

    http://en.wikipedia.org/wiki/Chess_symbols_in_Unicode
    --
    Ben.
    Ben Bacarisse, Aug 21, 2013
    #1
    1. Advertising

  2. Eli the Bearded <*@eli.users.panix.com> writes:

    > In comp.lang.perl.misc, Ben Bacarisse <> wrote:
    >> Eli the Bearded <*@eli.users.panix.com> writes:
    >> > will roll his own with HTML output if that's what's needed

    >> Maybe not "needed" but it's probably quite easy if using Unicode chess
    >> symbols is acceptable. I think they are quite well supported. Colours,
    >> patterns on squares, borders etc can then all be done with some simple
    >> CSS.

    >
    > I'm quite aware of that part of Unicode.


    OK, it seemed worth a mention.

    <snip>
    > The big issue with HTML is not making it, it is then limited to
    > HTML viewers / contexts. Getting a good HTML design to render in
    > a forum, etc, is fraught with difficulty.


    Ah, I misunderstood your closing remark and took it to mean that HTML
    was the intended rendering.

    <snip>
    --
    Ben.
    Ben Bacarisse, Aug 21, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kristof Thys

    visualizing image

    Kristof Thys, Sep 27, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    532
    Kevin Spencer
    Sep 27, 2004
  2. Varun Hiremath
    Replies:
    1
    Views:
    453
    Will McGugan
    Sep 18, 2006
  3. Dr Eberhard W Lisse

    Re: visualizing chess

    Dr Eberhard W Lisse, Aug 21, 2013, in forum: Perl Misc
    Replies:
    0
    Views:
    129
    Dr Eberhard W Lisse
    Aug 21, 2013
  4. Peter J. Holzer

    Re: visualizing chess

    Peter J. Holzer, Aug 21, 2013, in forum: Perl Misc
    Replies:
    0
    Views:
    126
    Peter J. Holzer
    Aug 21, 2013
  5. hymie!

    Re: visualizing chess

    hymie!, Aug 21, 2013, in forum: Perl Misc
    Replies:
    0
    Views:
    130
    hymie!
    Aug 21, 2013
Loading...

Share This Page