diff --git a/games/Phalanx/Phalanx.SlackBuild b/games/Phalanx/Phalanx.SlackBuild new file mode 100644 index 0000000000..58465b0434 --- /dev/null +++ b/games/Phalanx/Phalanx.SlackBuild @@ -0,0 +1,71 @@ +#!/bin/sh + +# Slackware build script for Phalanx + +# Written by Marco Pessotto +# 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 diff --git a/games/Phalanx/Phalanx.info b/games/Phalanx/Phalanx.info new file mode 100644 index 0000000000..bafb0fea91 --- /dev/null +++ b/games/Phalanx/Phalanx.info @@ -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" diff --git a/games/Phalanx/README b/games/Phalanx/README new file mode 100644 index 0000000000..22c6c9c44a --- /dev/null +++ b/games/Phalanx/README @@ -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 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. diff --git a/games/Phalanx/doinst.sh b/games/Phalanx/doinst.sh new file mode 100644 index 0000000000..fc8709b515 --- /dev/null +++ b/games/Phalanx/doinst.sh @@ -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 + diff --git a/games/Phalanx/patches/defines.patch b/games/Phalanx/patches/defines.patch new file mode 100644 index 0000000000..ab43807b5d --- /dev/null +++ b/games/Phalanx/patches/defines.patch @@ -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 \ diff --git a/games/Phalanx/patches/setboard.patch b/games/Phalanx/patches/setboard.patch new file mode 100644 index 0000000000..10b3bd2592 --- /dev/null +++ b/games/Phalanx/patches/setboard.patch @@ -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 */ ++/* 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 + +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 diff --git a/games/Phalanx/phalanx.6 b/games/Phalanx/phalanx.6 new file mode 100644 index 0000000000..f1eb9f7d9b --- /dev/null +++ b/games/Phalanx/phalanx.6 @@ -0,0 +1,98 @@ +.TH PHALANX "6" "January 2008" "Phalanx XXII" +.SH NAME +Phalanx \- Chess playing program +.SH SYNOPSIS +.B phalanx +[\fIoptions\fR] [\fI \fR[\fI\fR]] +.br +.B phalanx +[\fIoptions\fR] [\fI\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 +.HP +\fB\-f\fR +.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 +default: 0 (no resigning) +.TP +\fB\-e\fR +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 +.HP +\fB\-S\fR +.HP +\fB\-L\fR +.HP +\fB\-g\fR +.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 . This manual +page was written by Stephen Stafford 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. diff --git a/games/Phalanx/slack-desc b/games/Phalanx/slack-desc new file mode 100644 index 0000000000..9da1de6ae9 --- /dev/null +++ b/games/Phalanx/slack-desc @@ -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: