games/Phalanx: Added to 12.2 repository

This commit is contained in:
Marco Pessotto 2010-05-12 23:29:03 +02:00 committed by Robby Workman
parent 2dd617e910
commit 9b3543e49f
8 changed files with 452 additions and 0 deletions

View File

@ -0,0 +1,71 @@
#!/bin/sh
# Slackware build script for Phalanx
# Written by Marco Pessotto <melmothx@gmail.com>
# public domain
PRGNAM=Phalanx
VERSION=${VERSION:-XXII}
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar -xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# Apply a patch from the scid distribution by Pascal Georges, because this
# package is primary intended to run with scid. If you don't want this
# patch, just remove it from the patches/ directory
[ -f $CWD/setboard.patch.gz ] && patch -p1 < $CWD/patches/setboard.patch
# Set the defines by patching the Makefile.
patch -p0 < $CWD/patches/defines.patch
make CFLAGS="$SLKCFLAGS -Wall -fomit-frame-pointer --std=gnu89 -D_GNU_SOURCE"
strip --strip-unneeded phalanx
mkdir -p $PKG/usr/games
cp phalanx $PKG/usr/games
mkdir -p $PKG/usr/share/games/phalanx
cp eco.phalanx pbook.phalanx sbook.phalanx $PKG/usr/share/games/phalanx
mkdir -p $PKG/var/games/phalanx
install -m 0666 learn.phalanx $PKG/var/games/phalanx/
# Don't clobber an existing /var/games/phalanx/learn.phalanx
mv $PKG/var/games/phalanx/learn.phalanx \
$PKG/var/games/phalanx/learn.phalanx.new
# Add manpage from Debian
mkdir -p $PKG/usr/man/man6
gzip -9c $CWD/phalanx.6 > $PKG/usr/man/man6/phalanx.6.gz
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYING HISTORY README $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz

View File

@ -0,0 +1,8 @@
PRGNAM="phalanx"
VERSION="XXII"
HOMEPAGE="http://phalanx.sourceforge.net/"
DOWNLOAD="http://downloads.sourceforge.net/phalanx/Phalanx-XXII.tar.gz"
MD5SUM="24657c063f5fda57e70130483bd45cd0"
MAINTAINER="Marco Pessotto"
EMAIL="melmothx@gmail.com"
APPROVED="rworkman"

10
games/Phalanx/README Normal file
View File

@ -0,0 +1,10 @@
Phalanx is a free chess engine which understands the xboard
protocol. It's suitable for beginner and intermediate
players. Phalanx's playing style is quite human-like; when it plays at
full strength, it may be compared to a intermediate-to-strong club
player; beginners will be right at home with it, too.
This SlackBuild comes with a patch from Scid <scid.sourceforge.net> by
Pascal Georges, because this package is primary intended to be used
with scid. If you don't want the patch, simply remove "setboard.patch"
from the patches directory.

7
games/Phalanx/doinst.sh Normal file
View File

@ -0,0 +1,7 @@
# Don't clobber an existing /var/games/phalanx/learn.phalanx
if [ ! -r var/games/phalanx/learn.phalanx ]; then
mv var/games/phalanx/learn.phalanx.new var/games/phalanx/learn.phalanx
else
rm -f var/games/phalanx/learn.phalanx.new
fi

View File

@ -0,0 +1,20 @@
--- makefile.orig 2005-10-03 00:46:56.000000000 +0200
+++ makefile 2009-01-10 20:57:03.000000000 +0100
@@ -19,7 +19,16 @@
### -DLEARN_DIR=\"/var/local/lib\"
### -DQCAPSONLY
-DEFINES = -DGNUFUN
+DEFINES = -DGNUFUN \
+-DPBOOK_FILE=\"pbook.phalanx\" \
+-DSBOOK_FILE=\"sbook.phalanx\" \
+-DPBOOK_DIR=\"/usr/share/games/phalanx\" \
+-DSBOOK_DIR=\"/usr/share/games/phalanx\" \
+-DLEARN_DIR=\"/var/games/phalanx\" \
+-DLEARN_FILE=\"learn.phalanx\" \
+-DECO_FILE=\"eco.phalanx\" \
+-DECO_DIR=\"/usr/share/games/phalanx\"
+
LDFLAGS =
OBJ = .o/phalanx.o .o/bcreate.o .o/search.o .o/io.o .o/data.o \

View File

@ -0,0 +1,219 @@
diff -ur Phalanx-XXII/io.c Phalanx-XXII-scid/io.c
--- Phalanx-XXII/io.c 2005-10-03 00:29:22.000000000 +0200
+++ Phalanx-XXII-scid/io.c 2008-02-03 12:07:09.000000000 +0100
@@ -984,11 +984,11 @@
if( Inp[0] == '\0' )
if( fgets(Inp,255,stdin) == NULL ) strcpy(Inp,"quit\n");
- if( strncmp(Inp,"exit\n",5) == 0 && Flag.analyze )
+ if( strncmp(Inp,"exit",4) == 0 && Flag.analyze )
{ Flag.machine_color = Flag.analyze = 0; Inp[0]='\0'; return 1; }
- if( strncmp(Inp,"quit\n",5) == 0
- || strncmp(Inp,"exit\n",5) == 0 )
+ if( strncmp(Inp,"quit",4) == 0
+ || strncmp(Inp,"exit",4) == 0 )
{
if( Flag.ponder < 2 ) return 0;
else
@@ -1007,7 +1007,7 @@
}
/* COMMAND: analyze */
- if( strncmp( Inp, "analyze\n", 8 ) == 0 )
+ if( strncmp( Inp, "analyze", 7 ) == 0 )
{
if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
puts("analyze mode, type 'exit' to terminate");
@@ -1017,7 +1017,7 @@
}
/* COMMAND: force */
- if( strncmp( Inp, "force\n", 6 ) == 0 )
+ if( strncmp( Inp, "force", 5 ) == 0 )
{
if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
puts("you play both");
@@ -1027,8 +1027,8 @@
}
/* COMMANDS: white, black */
- if( strncmp( Inp, "white\n", 6 ) == 0
- || strncmp( Inp, "black\n", 6 ) == 0 )
+ if( strncmp( Inp, "white", 5 ) == 0
+ || strncmp( Inp, "black", 5 ) == 0 )
{
if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
puts("you do not play both");
@@ -1038,7 +1038,7 @@
}
/* COMMAND: both */
- if( strncmp( Inp, "both\n", 5 ) == 0 )
+ if( strncmp( Inp, "both", 4 ) == 0 )
{
if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
puts("machine plays both");
@@ -1047,7 +1047,7 @@
}
/* COMMAND: new */
- if( strncmp( Inp, "new\n", 4 ) == 0 )
+ if( strncmp( Inp, "new", 3 ) == 0 )
{
if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
setfen("rnbqkbnr/pppppppp/////PPPPPPPP/RNBQKBNR/w");
@@ -1062,7 +1062,7 @@
}
/* COMMAND: go */
- if( strncmp( Inp, "go\n", 3 ) == 0 )
+ if( strncmp( Inp, "go", 2 ) == 0 )
{
if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
Flag.machine_color = Color;
@@ -1070,11 +1070,11 @@
}
/* COMMAND: bd */
- if( strncmp( Inp, "bd\n", 3 ) == 0 || strncmp( Inp, "d\n", 2 ) == 0 )
+ if( strncmp( Inp, "bd", 2 ) == 0 || strncmp( Inp, "d\n", 2 ) == 0 )
{ printboard(NULL); Inp[0]='\0'; return 1; }
/* COMMAND: bk */
- if( strncmp( Inp, "bk\n", 3 ) == 0 )
+ if( strncmp( Inp, "bk", 2 ) == 0 )
{
tmove m[256]; int n;
extern void bk(tmove *, int );
@@ -1086,7 +1086,7 @@
}
/* COMMAND: post */
- if( strncmp( Inp, "post\n", 5 ) == 0 )
+ if( strncmp( Inp, "post", 4 ) == 0 )
{
Flag.post = 1;
puts("post on");
@@ -1094,7 +1094,7 @@
}
/* COMMAND: nopost */
- if( strncmp( Inp, "nopost\n", 7 ) == 0 )
+ if( strncmp( Inp, "nopost", 6 ) == 0 )
{
Flag.post = 0;
puts("post off");
@@ -1139,7 +1139,7 @@
/* COMMAND: hard */
- if( strncmp( Inp, "hard\n", 5 ) == 0 )
+ if( strncmp( Inp, "hard", 4 ) == 0 )
{
if( Flag.ponder==0 && Flag.easy==0 )
Flag.ponder = 1;
@@ -1148,7 +1148,7 @@
}
/* COMMAND: easy */
- if( strncmp( Inp, "easy\n", 5 ) == 0 )
+ if( strncmp( Inp, "easy", 4 ) == 0 )
{
if( Flag.ponder != 0 )
{
@@ -1189,7 +1189,7 @@
}
/* COMMAND: book */
- if( strncmp( Inp, "book\n", 5 ) == 0 )
+ if( strncmp( Inp, "book", 4 ) == 0 )
{
Flag.book = ! Flag.book;
if( Flag.book ) puts("book on");
@@ -1198,15 +1198,15 @@
}
/* COMMAND: about */
- if( strncmp( Inp, "about\n", 6 ) == 0 )
+ if( strncmp( Inp, "about", 5 ) == 0 )
{ about(); Inp[0]='\0'; return 1; }
/* COMMAND: fen */
- if( strncmp( Inp, "fen\n", 3 ) == 0 )
+ if( strncmp( Inp, "fen", 3 ) == 0 )
{ printpositionfen(); Inp[0]='\0'; return 1; }
/* COMMAND: help */
- if( strncmp( Inp, "help\n", 5 ) == 0 )
+ if( strncmp( Inp, "help", 4 ) == 0 )
{
puts("COMMAND SUMMARY: about (shows settings), bd (displays position - same");
puts("as 'd'), bk (shows book info), book (enables/disables book), both");
@@ -1240,7 +1240,7 @@
}
/* COMMAND: xboard */
- if( strncmp( Inp, "xboard\n", 7 ) == 0 )
+ if( strncmp( Inp, "xboard", 6 ) == 0 )
{
Flag.xboard = 2;
puts("xboard mode on");
@@ -1267,7 +1267,7 @@
}
/* COMMAND: undo (xboard) */
- if( strncmp( Inp, "undo\n", 5 ) == 0 || strncmp( Inp, "u\n", 2 ) == 0 )
+ if( strncmp( Inp, "undo", 4 ) == 0 || strncmp( Inp, "u\n", 2 ) == 0 )
{
if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
if( Counter != 0 )
@@ -1283,7 +1283,7 @@
}
/* COMMAND: remove (xboard) */
- if( strncmp( Inp, "remove\n", 7 ) == 0 )
+ if( strncmp( Inp, "remove", 6 ) == 0 )
{
if( Flag.ponder >= 2 ) { Abort = 1; return 0; }
if( Counter > 1 )
@@ -1309,6 +1309,15 @@
return 1;
}
+/* COMMAND: setboard <FEN> */
+/* added by Pascal Georges */
+ if( strncmp( Inp, "setboard ", 9 ) == 0 )
+ {
+ setfen(Inp+9);
+ Inp[0] = '\0';
+ return 1;
+ }
+
/* COMMAND: test a position */
if( sevenslashes(Inp) ) /* test */
{
diff -ur Phalanx-XXII/phalanx.h Phalanx-XXII-scid/phalanx.h
--- Phalanx-XXII/phalanx.h 2005-10-03 00:41:14.000000000 +0200
+++ Phalanx-XXII-scid/phalanx.h 2008-07-14 10:45:41.000000000 +0200
@@ -1,7 +1,7 @@
#ifndef PHALANX_INCLUDED
#define PHALANX_INCLUDED
-#define VERSION "XXII"
+#define VERSION "XXII-pg"
#ifdef GNUFUN
# include <getopt.h>
diff -ur Phalanx-XXII/README Phalanx-XXII-scid/README
--- Phalanx-XXII/README 2005-09-21 02:38:39.000000000 +0200
+++ Phalanx-XXII-scid/README 2008-02-03 12:07:09.000000000 +0100
@@ -1,2 +1,6 @@
+*********************************************************
+[December 2006 : added setboard option - Pascal Georges ]
+*********************************************************
+
Phalanx is a chess playing program
Copyright (c) 1997, 1998, 1999, 2000 Dusan Dobes

98
games/Phalanx/phalanx.6 Normal file
View File

@ -0,0 +1,98 @@
.TH PHALANX "6" "January 2008" "Phalanx XXII"
.SH NAME
Phalanx \- Chess playing program
.SH SYNOPSIS
.B phalanx
[\fIoptions\fR] [\fI<moves> <minutes> \fR[\fI<increment in seconds>\fR]]
.br
.B phalanx
[\fIoptions\fR] [\fI<seconds per move>\fR]
.br
.B phalanx
\fIbench\fR
.br
.B phalanx
\fIbcreate \fR[\fIoptions\fR]
.SH DESCRIPTION
This manual page documents briefly the
.BR phalanx
program.
This manual page was written for the Debian GNU/Linux distribution
(but may be used by others), because the original program does not
have a manual page.
.PP
.B phalanx
is a chess playing program. It is partially xboard compatible. Under
xboard, it can play games, force & undo moves, and show thinking. In
this version, you cannot set positions with xboard.
.PP
It is also possible to run phalanx without xboard. Do
.B phalanx -?
to get a list of command line options. One important command of
phalanx's ASCII interface is
.B help.
.PP
.B phalanx
uses (traditional) 10x12 board implementation. There are three often
used board implementations: "8x8" (GNU Chess), "bitboard" (Crafty), and
"10x12" (Nimzo, Phalanx). In short, "10x12" is easy to implement and the
code is small (==fast on PC). Opening book is small, simple,
hand-written.
.PP
.SH OPTIONS
\fB\-t\fR <transposition table size in kilobytes>
.HP
\fB\-f\fR <fixed search time in seconds>
.TP
\fB\-x\fR <+/->
xboard mode on/off default: on
.TP
\fB\-p\fR <+/->
permanent brain on/off default: off
.TP
\fB\-s\fR <+/->
show thinking on/off default: off
.TP
\fB\-c\fR <+/->
cpu time default: off
.TP
\fB\-o\fR <+/->
polling input default: on
.TP
\fB\-b\fR <+/->
opening book default: on
.TP
\fB\-r\fR <resign value in centipawns>
default: 0 (no resigning)
.TP
\fB\-e\fR <easy level 0...100>
default: 0 (best play)
.TP
\fB\-l\fR <+/->
learning on/off default: on
.TP
\fB\-v\fR
print version and exit
.HP
\fB\-P\fR <primary book directory>
.HP
\fB\-S\fR <secondary book directory>
.HP
\fB\-L\fR <learning file directory>
.HP
\fB\-g\fR <log file name>
.PP
.SH EXAMPLES
phalanx \fB\-c\fR+ \fB\-s\fR+ \fB\-o\fR - \fB\-x\-\fR \fB\-f\fR 60 \fB\-t4000\fR
xboard \fB\-fcp\fR "phalanx \fB\-l\fR+ \fB\-r800\fR"
.SH "SEE ALSO"
/usr/doc/Phalanx-*,
.IR xboard(6)
.SH AUTHOR
Phalanx was written by Dusan Dobes <dobes@math.muni.cz>. This manual
page was written by Stephen Stafford <bagpuss@debian.org> for the Debian
GNU/Linux project, but may be used by others. It was written with the
assistance of
.IR help2man(1)
and then edited slightly to clean it up. Modified by Marco Pessotto.

19
games/Phalanx/slack-desc Normal file
View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also customary
# to leave one space after the ':'.
|----hardy-ruler-------------------------------------------------------|
Phalanx: Phalanx (GPL'd chess engine)
Phalanx:
Phalanx: Phalanx is a chess engine which understands the xboard protocol. It's
Phalanx: suitable for beginner and intermediate players. Phalanx's playing
Phalanx: style is quite human-like; when it plays at full strength, it may
Phalanx: be compared to a intermediate-to-strong club player; beginners will
Phalanx: be right at home with it, too.
Phalanx:
Phalanx: (http://phalanx.sourceforge.net/)
Phalanx:
Phalanx: