Pawn chess program

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

ethanara
Posts: 134
Joined: Mon May 16, 2011 6:58 pm
Location: Denmark

Pawn chess program

Post by ethanara »

Hi all
It may look like im spamming the whole forum, but i am just interested in computer chess :)
Here's my question:
How can you edit a normal chess engine into making it play Pawn chess ? Can you for example show a Micromax Pawn Chess version?
If you read the rules of pawn chess, it may look simple, and i also think its simple, But Can you make a engine play this perfectly ?
Thanks in advance
Ethan Ara
User avatar
hgm
Posts: 27815
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Pawn chess program

Post by hgm »

Without modification of the engine this is not possible, because of the condition that a promotion is winning. Merely attaching a very high score to promotion would not suffice, and gives the same effect as when you don't implement checkmate, and just give the King a very high piece value: the program will start to trade Kings, and reply to check with a counter-check! A single line could be added to Fairy-Max, however, to implement this rule.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Pawn chess program

Post by Sven »

I have created a Pawn Chess engine named "KnockOut-PawnChess 1.2" which can be downloaded here. My goal was to make an engine which plays "perfect" but I have not been successful with that so far. Nevertheless I hope it plays fairly strong.

The engine uses the WinBoard protocol. You need a very recent WinBoard version that supports the "alien" extensions. To run the engine using WinBoard you currently need to specify the option

Code: Select all

/variant alien
on the WB command line, otherwise it will not work (WinBoard would display the standard chess starting position). I did not find any other way but this one works for me, at least (I am not sure whether HGM will provide another variant "pawnchess" ...).

The rules again (see also the link in the OP):
- Only eight pawns for each side
- First promotion wins
- Capturing last piece of enemy wins
- En passant as in standard chess

Furthermore, my interpretation of the rules is that the game is a draw if the moving side has only blocked pawns and can't make a move (but is not lost according to the above two rules).

Description:
- Hash table size is fixed to 128 MB, not configurable yet
- No "setboard" or "edit", no "analyze", some other WB commands still missing, too (so you just can play games from the initial position) ...
- EDIT: engine is available for Win32 only at the moment

The engine is partially based on my chess engine KnockOut but a lot has been either omitted or completely rewritten. Here some highlights:

- Board: Bitboard (quite trivial for pawns)

- Evaluation: very minimalistic, only material, passed pawns, backward pawns and advancement

- Search: PVS, Iterative Deepening with Aspiration Window, no NullMove, no LMR or other pruning methods

- Move Ordering: hash move + captures + killer moves + normal moves (promotion and promotion threat detected by search)


I would be interested in some feedback about this program. Are there any other PawnChess engines out there?

Sven
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Pawn chess program

Post by Daniel Shawul »

The engine uses the WinBoard protocol. You need a very recent WinBoard version that supports the "alien" extensions. To run the engine using WinBoard you currently need to specify the option
Code:

/variant alien

on the WB command line, otherwise it will not work (WinBoard would display the standard chess starting position). I did not find any other way but this one works for me, at least (I am not sure whether HGM will provide another variant "pawnchess" ...)
+100 :)
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Pawn chess program

Post by Sven »

Daniel Shawul wrote:
The engine uses the WinBoard protocol. You need a very recent WinBoard version that supports the "alien" extensions. To run the engine using WinBoard you currently need to specify the option
Code:

/variant alien

on the WB command line, otherwise it will not work (WinBoard would display the standard chess starting position). I did not find any other way but this one works for me, at least (I am not sure whether HGM will provide another variant "pawnchess" ...)
+100 :)
You have been sitting in front of your computer watching out only for this post, haven't you? :-)

Sven
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Pawn chess program

Post by Sven »

Daniel,

you might be disappointed when trying my PawnChess engine, since it does not use anything from the new "alien" stuff (I did not follow the most recent discussions closely) apart from the ability to let the engine define the initial position via "setup".

Sven
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Pawn chess program

Post by Daniel Shawul »

It played one game perfectly! And it can update the board properly with setup. More later.

First game:
[Event "Computer Chess Game"]
[Site "CEE-3624-AB52"]
[Date "2011.06.29"]
[Round "-"]
[White "KnockOut_PawnChess 1.2"]
[Black "KnockOut_PawnChess 1.2"]
[Result "1/2-1/2"]
[TimeControl "240/60"]
[Variant "alien"]
[FEN "8/pppppppp/8/8/8/8/PPPPPPPP/8 w - - 0 1"]
[SetUp "1"]

{--------------
. . . . . . . .
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
. . . . . . . .
white to play
--------------}
1. a4 {+0.00/8} a5 {-0.02/8 0.2} 2. e4 {+0.02/9 0.2} g5 {-0.02/10 0.2} 3.
c3 {+0.00/10 0.2} h5 {-0.02/10 0.2} 4. d4 {-0.02/10 0.2} b6 {+0.00/11 0.2}
5. b4 {+0.00/11 0.2} c6 {+0.00/12 0.2} 6. bxa5 {-0.04/13 0.2} bxa5
{-0.04/15 0.2} 7. c4 {+0.04/14 0.2} d6 {+0.00/19 0.2} 8. h3 {+0.00/23 0.2}
c5 {+0.00/39 0.2} 9. dxc5 {+0.00/48 0.1} dxc5 {+0.00/47 0.1} 10. e5
{+0.00/46 0.1} g4 {+0.00/45 0.1} 11. hxg4 {+0.00/44 0.1} hxg4
{+0.00/43 0.1} 12. f4 {+0.00/42 0.1} gxf3 {+0.00/41 0.1} 13. gxf3
{+0.00/40 0.1} f5 {+0.00/39 0.1} 14. f4 {+0.00/38 0.1} e6 {+0.00/8 0.1}
{Draw} 1/2-1/2
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Pawn chess program

Post by Daniel Shawul »

Here is a win after so many draws
[Event "Computer Chess Game"]
[Site "CEE-3624-AB52"]
[Date "2011.06.29"]
[Round "-"]
[White "KnockOut_PawnChess 1.2"]
[Black "KnockOut_PawnChess 1.2"]
[Result "0-1"]
[TimeControl "240/60"]
[Variant "alien"]
[FEN "8/pppppppp/8/8/8/8/PPPPPPPP/8 w - - 0 1"]
[SetUp "1"]

{--------------
. . . . . . . .
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
. . . . . . . .
white to play
--------------}
1. a4 {+0.02/9} a5 {+0.00/9 0.2} 2. g4 {+0.00/10 0.2} g5 {-0.02/10 0.2} 3.
c3 {+0.00/10 0.2} c5 {-0.02/11 0.2} 4. b3 {+0.00/12 0.2} d5 {+0.00/12 0.2}
5. d4 {-0.26/13 0.2} cxd4 {+1.16/15 0.2} 6. cxd4 {-5.70/17 0.2} e5
{+299.81/18 0.2} 7. dxe5 {-300.00/27 0.2} d4 {+299.83/17 0.1} 8. f3
{-299.84/36 0.2} b6 {+299.85/15 0.1} 9. e6 {-299.86/48 0.2} fxe6
{+299.87/13 0.1} 10. h3 {-299.88/46 0.1} h6 {+299.89/11 0.1} 11. f4
{-299.90/44 0.1} gxf4 {+299.91/9 0.1} 12. h4 {-299.92/42 0.1} d3
{+299.93/7 0.1} 13. exd3 {-299.94/40 0.1} f3 {+299.95/5 0.1} 14. d4
{-299.96/38 0.1} f2 {+299.97/3 0.1} 15. d5 {-299.98/36 0.1} f1=Q
{+299.99/1 0.1}
{Black mates} 0-1

Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: Pawn chess program

Post by Daniel Shawul »

I can't beat it. It is a very tactical game. One pawn blocked 3 of mine so I got to be cautious next time.
[Event "Computer Chess Game"]
[Site "CEE-3624-AB52"]
[Date "2011.06.29"]
[Round "-"]
[White "dabdi001"]
[Black "KnockOut_PawnChess 1.2"]
[Result "0-1"]
[TimeControl "240/60"]
[Variant "alien"]
[FEN "8/pppppppp/8/8/8/8/PPPPPPPP/8 w - - 0 1"]
[SetUp "1"]

{--------------
. . . . . . . .
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
. . . . . . . .
white to play
--------------}
1. e4 g5 {+0.02/9 0.2} 2. g3 g4 {+0.16/10 0.2} 3. d4 b5 {+0.24/10 0.2} 4.
c3 a5 {+1.16/12 0.2} 5. b3 b4 {+299.85/14 0.2} 6. c4 c5 {+299.87/13} 7.
dxc5 e5 {+299.89/11} 8. h3 gxh3 {+299.95/5} 9. g4 h2 {+299.97/3} 10. g5
h1=Q {+299.99/1}
{Black mates} 0-1

User avatar
hgm
Posts: 27815
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Pawn chess program

Post by hgm »

Sven Schüle wrote:you might be disappointed when trying my PawnChess engine, since it does not use anything from the new "alien" stuff (I did not follow the most recent discussions closely) apart from the ability to let the engine define the initial position via "setup".
Actually, setup for an initial positions (as opposed to after every move) would work in any variant, even with WinBoard 4.5.2, provided legality testing is off. Fairy-Max uses this undocumented feature to setup the initial position for variant fairy, which in Fairy-Max can be chosen through an engine option to be a number of different setups from "Chess with Different Armies".

In 4.3 / 4.4 it would still be possible to do that through the option -lpf FILE.fen (-loadPositionFile), when you prepared a file with the FEN of the initial position. This is for instance how I let Shokidoki play mini-Shogi in the WinBoard install:

Shokidoki /fd="..." /lpf=mini.fen /boardWidth=5 /boardHeight=5 /holdingsSize=5

As long as you would not switch variant, WinBoard would continue to use the position file for every new game you start. But the "setup" command does that much cleaner, and it is true that in the Alien branch its capabilities were extended to also specify the board format. In 4.5.2 that would not work yet, and the user has to sepcify the non-standard board size.