New chess library Plisco (and toy engine plisco)

Discussion of chess software programming and technical issues.

Moderator: Ras

gflohr
Posts: 72
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

New chess library Plisco (and toy engine plisco)

Post by gflohr »

I have published today the library Chess::Plisco for Perl. It is available on CPAN (https://metacpan.org/dist/Chess-Plisco/ ... Plisco.pod) and on Github (https://github.com/gflohr/Chess-Plisco). It also contains a UCI-compatible toy engine "plisco" which is not meant to be a serious competitor, although it can surely be an adornment of the tail of any computer chess ratings list. ;)

The library contains a lot of things that you need for rapidly prototyping a chess engine or other chess software in Perl. Some features are:

* bitboards for board representation
* legal and pseudo-legal move generation
* generation of captures, promotions and (most) checks
* undoing moves
* static exchange evaluation
* overridable piece values
* position signatures/fingerprints using Zobrist hashing
* integrated perft interface
* parsing and generation of Standard Algebraic Notation as well as Long Algebraic Notation of moves
* parsing and generation of FEN

The software ships with a large test suite that ensures a high test coverage. Last but not least, it runs about 30 % faster than python-chess, Python's de-facto standard chess library.

Corrections, additions, and github stars if you like it, are always welcome!
tcusr
Posts: 325
Joined: Tue Aug 31, 2021 10:32 pm
Full name: tcusr

Re: New chess library Plisco (and toy engine plisco)

Post by tcusr »

i never understood why people use bitboards with dynamic languages
User avatar
emadsen
Posts: 441
Joined: Thu Apr 26, 2012 1:51 am
Location: Oak Park, IL, USA
Full name: Erik Madsen

Re: New chess library Plisco (and toy engine plisco)

Post by emadsen »

gflohr wrote: Sun Sep 19, 2021 6:07 pm I have published today the library Chess::Plisco for Perl. It is available on CPAN (https://metacpan.org/dist/Chess-Plisco/ ... Plisco.pod) and on Github (https://github.com/gflohr/Chess-Plisco). It also contains a UCI-compatible toy engine "plisco" which is not meant to be a serious competitor, although it can surely be an adornment of the tail of any computer chess ratings list. ;)
Cool. Perl is underrepresented in the chess engine community. So bravo for your contribution! Does Plisco understand regular expressions? :) Probably has better support for them than Stockfish.
Erik Madsen | My C# chess engine: https://www.madchess.net
gflohr
Posts: 72
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

Re: New chess library Plisco (and toy engine plisco)

Post by gflohr »

emadsen wrote: Tue Sep 21, 2021 5:27 am Cool. Perl is underrepresented in the chess engine community. So bravo for your contribution! Does Plisco understand regular expressions? :) Probably has better support for them than Stockfish.
Where is a chess engine supposed to understand regular expressions? I didn't really get that.

In fact, the only place where I use regexes in the core chess code is the SAN parser. From the information that I find in the move I generate a string/regex like "B..c4" and match that against all valid moves of the position to see if I find exactly one match.
User avatar
emadsen
Posts: 441
Joined: Thu Apr 26, 2012 1:51 am
Location: Oak Park, IL, USA
Full name: Erik Madsen

Re: New chess library Plisco (and toy engine plisco)

Post by emadsen »

gflohr wrote: Tue Sep 21, 2021 12:08 pm Where is a chess engine supposed to understand regular expressions? I didn't really get that.
It's a joke. Hence the smiley face. Perl is known for text processing and RegEx.
Erik Madsen | My C# chess engine: https://www.madchess.net
gflohr
Posts: 72
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

Re: New chess library Plisco (and toy engine plisco)

Post by gflohr »

emadsen wrote: Tue Sep 21, 2021 5:27 pm It's a joke. Hence the smiley face. Perl is known for text processing and RegEx.
Yes, sure. I just wasn't 100 % sure that you really meant it as a joke.

But as stated above, the project is not meant to be a serious competitor in computer chess. But just like with python-chess, it can be quite helpful tohave chess functionality available in a scripting language, because you can quickly try out new ideas, you can generate test data, write driver scripts and such stuff. I am not really a Python guy, and so I had used other Perl chess libraries for such purposes in the past. But they were all way to slow sooner or later, and so I decided to write something that is on par with python-chess. Some things just don't work, when a search to depth 3 takes you a minute already.
gflohr
Posts: 72
Joined: Fri Jul 23, 2021 5:24 pm
Location: Elin Pelin
Full name: Guido Flohr

Re: New chess library Plisco (and toy engine plisco)

Post by gflohr »

I was able to build a Windows executable of the engine, see here: https://github.com/gflohr/Chess-Plisco/releases

The executable image works without installing a Perl interpreter, at least on a Windows box that I have access to. A version running on a recent MacBook Pro can be watched on Lichess: https://lichess.org/@/plisco-bot
OttoLau
Posts: 21
Joined: Wed Oct 22, 2025 7:10 pm
Location: Finland
Full name: Otto Laukkanen

Re: New chess library Plisco (and toy engine plisco)

Post by OttoLau »

gflohr wrote: Sun Dec 21, 2025 9:03 am I was able to build a Windows executable of the engine, see here: https://github.com/gflohr/Chess-Plisco/releases

The executable image works without installing a Perl interpreter, at least on a Windows box that I have access to. A version running on a recent MacBook Pro can be watched on Lichess: https://lichess.org/@/plisco-bot
Thanks for the engine, will definitely be adding to my testing. Ill let you know if i spot anything weird
User avatar
Roland Chastain
Posts: 695
Joined: Sat Jun 08, 2013 10:07 am
Location: France
Full name: Roland Chastain

Re: New chess library Plisco (and toy engine plisco)

Post by Roland Chastain »

Can't wait to test your toy engine.

My first attempt under Linux fails, I don't know why.

Code: Select all

$ git clone https://github.com/gflohr/Chess-Plisco.git plisco
...
$ cd plisco
$ perl Makefile.PL
Checking if your kit is complete...
Warning: the following files are missing in your kit:
        META.json
        META.yml
        README.pod
        t/release-cpan-changes.t
Please inform the author.
Warning: prerequisite Chess::Opening::Book::Polyglot 0 not found.
Warning: prerequisite Chess::PGN::Parse 0 not found.
Warning: prerequisite File::Globstar 0 not found.
Warning: prerequisite Math::Int64 0 not found.
Warning: prerequisite Sys::Mmap 0 not found.
Warning: prerequisite Tie::Cache::LRU 0 not found.
Generating a Unix-style Makefile
Writing Makefile for Chess::Plisco
Writing MYMETA.yml and MYMETA.json
[roland@localhost plisco (main)]$ make
cp lib/Chess/Plisco/Engine/TimeControl.pm blib/lib/Chess/Plisco/Engine/TimeControl.pm
cp lib/Chess/Plisco/Tablebase/SearchTree.pm blib/lib/Chess/Plisco/Tablebase/SearchTree.pm
cp lib/Chess/Plisco/Engine/Position.pm blib/lib/Chess/Plisco/Engine/Position.pm
cp lib/Chess/Plisco/Macro/movesFromMask.pm blib/lib/Chess/Plisco/Macro/movesFromMask.pm
cp lib/Chess/Plisco/Engine/Tree.pm blib/lib/Chess/Plisco/Engine/Tree.pm
cp lib/Chess/Plisco/Macro/abs.pm blib/lib/Chess/Plisco/Macro/abs.pm
cp lib/Chess/Plisco/EPD/Record.pod blib/lib/Chess/Plisco/EPD/Record.pod
cp lib/Chess/Plisco/Macro/moveAttacked.pm blib/lib/Chess/Plisco/Macro/moveAttacked.pm
cp lib/Chess/Plisco/Engine/TranspositionTable.pm blib/lib/Chess/Plisco/Engine/TranspositionTable.pm
cp lib/Chess/Plisco/Macro.pm blib/lib/Chess/Plisco/Macro.pm
cp lib/Chess/Plisco/Tablebase/Syzygy.pod blib/lib/Chess/Plisco/Tablebase/Syzygy.pod
cp lib/Chess/Plisco/EPD.pod blib/lib/Chess/Plisco/EPD.pod
cp lib/Chess/Plisco/Macro/countIsolatedTrailingZbits.pm blib/lib/Chess/Plisco/Macro/countIsolatedTrailingZbits.pm
cp lib/Chess/Plisco/Macro/promotionMovesFromMask.pm blib/lib/Chess/Plisco/Macro/promotionMovesFromMask.pm
cp lib/Chess/Plisco/Macro/attacked.pm blib/lib/Chess/Plisco/Macro/attacked.pm
cp lib/Chess/Plisco/Tablebase/Syzygy.pm blib/lib/Chess/Plisco/Tablebase/Syzygy.pm
cp lib/Chess/Plisco.pod blib/lib/Chess/Plisco.pod
cp lib/Chess/Plisco/Engine/InputWatcher.pm blib/lib/Chess/Plisco/Engine/InputWatcher.pm
cp lib/Chess/Plisco/EPD/Record.pm blib/lib/Chess/Plisco/EPD/Record.pm
cp lib/Chess/Plisco/Engine/LimitsType.pm blib/lib/Chess/Plisco/Engine/LimitsType.pm
cp lib/Chess/Plisco.pm blib/lib/Chess/Plisco.pm
cp lib/Chess/Plisco/Macro/clearButMostSet.pm blib/lib/Chess/Plisco/Macro/clearButMostSet.pm
cp lib/Chess/Plisco/Engine/Tree.pod blib/lib/Chess/Plisco/Engine/Tree.pod
cp lib/Chess/Plisco/Macro/movePinned.pm blib/lib/Chess/Plisco/Macro/movePinned.pm
cp lib/Chess/Plisco/Engine.pm blib/lib/Chess/Plisco/Engine.pm
cp lib/Chess/Plisco/Engine/TimeControl/MovesToGo.pm blib/lib/Chess/Plisco/Engine/TimeControl/MovesToGo.pm
cp lib/Chess/Plisco/Engine/Win32Wrapper.pm blib/lib/Chess/Plisco/Engine/Win32Wrapper.pm
cp lib/Chess/Plisco/EPD.pm blib/lib/Chess/Plisco/EPD.pm
cp lib/Chess/Plisco/Macro/countTrailingZbits.pm blib/lib/Chess/Plisco/Macro/countTrailingZbits.pm
cp lib/Chess/Plisco/Engine/Book.pm blib/lib/Chess/Plisco/Engine/Book.pm
cp lib/Chess/Plisco/Macro.pod blib/lib/Chess/Plisco/Macro.pod
cp EMM-header.pm blib/lib/Chess/EMM-header.pm
cp lib/Chess/Plisco/Engine.pod blib/lib/Chess/Plisco/Engine.pod
cp lib/Chess/Plisco/Tutorial.pod blib/lib/Chess/Plisco/Tutorial.pod
cp bin/plisco blib/script/plisco
"/usr/bin/perl5.36.0" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/plisco
Manifying 8 pod documents
$ perl -Ilib bin/plisco
Can't locate Chess/Opening/Book/Polyglot.pm in @INC (you may need to install the Chess::Opening::Book::Polyglot module) (@INC contains: lib /usr/local/lib64/perl5/5.36 /usr/local/share/perl5/5.36 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at lib/Chess/Plisco/Engine/Book.pm line 19.
BEGIN failed--compilation aborted at lib/Chess/Plisco/Engine/Book.pm line 19.
Compilation failed in require at lib/Chess/Plisco/Engine.pm line 28.
BEGIN failed--compilation aborted at lib/Chess/Plisco/Engine.pm line 28.
Compilation failed in require at bin/plisco line 14.
BEGIN failed--compilation aborted at bin/plisco line 14.
Qui trop embrasse mal étreint.

Author of Eschecs, a simple UCI chess GUI written in Pascal.