9 Replies - 1305 Views - Last Post: 10 March 2008 - 03:14 PM

#1 rpd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 65
  • Joined: 13-August 07

Help to run chesspovgen perl script

Post icon  Posted 05 March 2008 - 05:21 AM

Hi
Can you please help me run a perl script utility named chesspovgen?
The aim of the script is to take a chess position (FEN notation) and create a .pov file that can be rendered with POVray to give an povray image file (bmp or jpg).
(I have the windows POVray program installed & can generate images with it from .pov files).
The chesspovgen utility comes from sourceforge with little to no help file ( this is the only instruction-
'If you want to render chess positions in 3-D as part of a utility / application, you can use this software to generate
JPEG or PNG images, given a position in FEN notation as input.
You can simply pipe a string with the FEN notation of a position to the Perl script in the project.
You can redirect the output to a .pov file. You can invoke the POV-Ray program to render this file.')

The perl script is a file called genpov.pl
The FEN notation I want to use is
r1bqk1nr/pppp1ppp/2nb4/4p3/3PP3/5N2/PPP2PPP/RNBQKB1R w KQkq - 0 4

So far when I try & run this I get this error message in the dos box
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>per
l genpov.pl r1bqk1nr/pppp1ppp/2nb4/4p3/3PP3/5N2/PPP2PPP/RNBQKB1R w KQkq - 0 4 >
chess.pov
Can't locate Games/Chess.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib
.) at genpov.pl line 21.
BEGIN failed--compilation aborted at genpov.pl line 21.

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>

(I do get a file called chess.pov created in the chessPOVgen folder but it is empty!)
Does the chesspovgen folder have to be in C:/Perl/lib?

I am afraid I don't know how to manage this script and I am very grateful if someone can help me with this (what is Games/Chess.pm in @INC ?).
I look forward to some helpful reply, thank you

Is This A Good Question/Topic? 0
  • +

Replies To: Help to run chesspovgen perl script

#2 bhandari  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 9
  • View blog
  • Posts: 754
  • Joined: 31-January 08

Re: Help to run chesspovgen perl script

Posted 05 March 2008 - 06:27 AM

:code:
Was This Post Helpful? 0
  • +
  • -

#3 KevinADC  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 401
  • Joined: 23-January 07

Re: Help to run chesspovgen perl script

Posted 05 March 2008 - 02:31 PM

It looks like you need to install Chess.pm or Games::Chess.pm

It is listed on CPAN:

http://search.cpan.o....2/lib/Chess.pm

but you might be using activestate perl if you are on windows. You can try using the PPM application to install the module. ActiveState perl comes with the documentation you need to read concerning how to use PPM, it can be as simple as:

c:\>ppm

(then after PPM is running)

install Chess

but you need to read up first, installing modules can be tricky and frustrating at first.
Was This Post Helpful? 0
  • +
  • -

#4 rpd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 65
  • Joined: 13-August 07

Re: Help to run chesspovgen perl script

Posted 06 March 2008 - 03:07 AM

Hi KevinADC
Thanks for your helpful reply. From your advice I installed the chess module (using ppm - it is installed with activestate perl-).This took a little bit of fiddling with to get it to run (it needed the correct directory structure).
However it seems alright now but when I run the script now I can get a .pov output file but this file remains empty of code!
I here show the cmd box output I get:
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>per
l genpov.pl r1bqk1nr/pppp1ppp/2nb4/4p3/3PP3/5N2/PPP2PPP/RNBQKB1R w KQkq - 0 4 >
chesspos.pov

So chesspos.pov is a new .pov file but contains no code. From this I deduce (rightly or wrongly!?) the error now is in passing the fen string to the genpov.pl perl script.
The text instructions I have say pipe the fen as a string to the script (I copied this in my first post seen above).
I am now trying to find how I do this (internet perl tutorial/help searching) but have yet to find the answer.
Could you please advise me on this?
I am very grateful for more of your help to get this working, many thanks again,
Was This Post Helpful? 0
  • +
  • -

#5 rpd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 65
  • Joined: 13-August 07

Re: Help to run chesspovgen perl script

Posted 07 March 2008 - 06:32 AM

Hi
I am still struggling with this script.When I ran the perl intrepreter I added -w to check for errors (? is that the right command).
I paste below the result:
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>per
l -w genpov.pl r1b2rk1/2p1qppp/p1p5/3pP3/4n3/8/PPP2PPP/RNBQ1RK1 w - - 0 10 > chesspov.pl
"my" variable $board masks earlier declaration in same scope at C:/Perl/site/lib
/Chess/Piece/King.pm line 149.

Can anyone advise me on how to fix this please?
Again I look forward to a reply, thanks
Was This Post Helpful? 0
  • +
  • -

#6 rpd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 65
  • Joined: 13-August 07

Re: Help to run chesspovgen perl script

Posted 07 March 2008 - 06:38 AM

View Postrpd, on 7 Mar, 2008 - 06:32 AM, said:

Hi
I am still struggling with this script.When I ran the perl intrepreter I added -w to check for errors (? is that the right command).
I paste below the result:
Microsoft Windows XP [Version 5.1.2600]
Copyright 1985-2001 Microsoft Corp.

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>per
l -w genpov.pl r1b2rk1/2p1qppp/p1p5/3pP3/4n3/8/PPP2PPP/RNBQ1RK1 w - - 0 10 > chesspov.pl
"my" variable $board masks earlier declaration in same scope at C:/Perl/site/lib
/Chess/Piece/King.pm line 149.

Can anyone advise me on how to fix this please?
Again I look forward to a reply, thanks


Slight error with the code above (should have been > chesspos.pov)
as I copy here
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>per
l -w genpov.pl r1b2rk1/2p1qppp/p1p5/3pP3/4n3/8/PPP2PPP/RNBQ1RK1 w - - 0 10 > che
sspos.pov
"my" variable $board masks earlier declaration in same scope at C:/Perl/site/lib
/Chess/Piece/King.pm line 149.

Not that this mistake makes any difference to this"my" variable problem.
Thanks again
Was This Post Helpful? 0
  • +
  • -

#7 KevinADC  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 401
  • Joined: 23-January 07

Re: Help to run chesspovgen perl script

Posted 07 March 2008 - 04:12 PM

I don't know anything about the modules you are using, but this will not work properly:

genpov.pl r1bqk1nr/pppp1ppp/2nb4/4p3/3PP3/5N2/PPP2PPP/RNBQKB1R w KQkq - 0 4 >
chesspos.pov

perl uses the spaces in the command line to seperate the commands you send to the perl script. Try wrapping the FEN code in quotes:

genpov.pl "r1bqk1nr/pppp1ppp/2nb4/4p3/3PP3/5N2/PPP2PPP/RNBQKB1R w KQkq - 0 4" >
chesspos.pov

and see if that helps. If not, the script is not written to recieve data this way.
Was This Post Helpful? 0
  • +
  • -

#8 rpd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 65
  • Joined: 13-August 07

Re: Help to run chesspovgen perl script

Posted 07 March 2008 - 04:36 PM

Hi again
Thanks KevinADC
I used the quotes for the FEN but still am getting this error message about "my" variable eg;
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>per
l -w genpov.pl "r1bqk1nr/pppp1ppp/2nb4/4p3/3PP3/5N2/PPP2PPP/RNBQKB1R w KQkq - 0
4" > chesspos.pov
"my" variable $board masks earlier declaration in same scope at C:/Perl/site/lib
/Chess/Piece/King.pm line 149.

So how do I debug this:"my" variable $board masks earlier declaration in same scope at C:/Perl/site/lib
/Chess/Piece/King.pm line 149.?

I am grateful again for any advice & help(!!- I am enjoying trying to learn Perl but this is a tough initiation to it.) Thanks & good wishes
Was This Post Helpful? 0
  • +
  • -

#9 rpd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 65
  • Joined: 13-August 07

Re: Help to run chesspovgen perl script

Posted 09 March 2008 - 10:38 AM

Hi again
I am still trying to get this script working.I have had advice to input the chess FEN position with "type".
Having done this though I now get this error message which I would like some help with to solve:

Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>typ
e chess.fen | perl genpov.pl > chesspos.pov
Can't locate object method "new" via package "Games::Chess::Position" (perhaps you forgot to load "Games::Chess::Position"?) at genpov.pl line 26, <STDIN> line
1.

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>

I am very grateful if someone can give me help and advice to fix this.Thanks
Was This Post Helpful? 0
  • +
  • -

#10 rpd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 65
  • Joined: 13-August 07

Re: Help to run chesspovgen perl script

Posted 10 March 2008 - 03:14 PM

I finally today succeeded in running this genpov.pl file & outputted the POVray file which on running POVray produced a .bmp of the chess position.

I am not certain how I did this! The error message was I felt,pointing to the installed Chess perl module (or possibly other modules) & I moved some directories & files in the Perl lib/site directories. So I am somewhat put off Perl programming having experienced this problem as this has taken a long time to fix & the exact reason is still not clear!I have a lot to learn about Perl & POVray. I hope my further efforts will be smoother!
I have found a couple of ways to input the FEN -here is one way-in a file using type at cmd prompt then perl > chesspos.pov ie

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>type position.fen | perl genpov.pl > chesspos3.pov

P:\CHESS_GamesandChessinfo\CHESS ENGINES\chessPOVgen\chessPOVgen\chessPOVgen>

That's it then.Goodluck to any & all new Perl programmers!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1