Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: mirrored fen

Author: Daniel Clausen

Date: 06:13:28 11/19/03

Go up one level in this thread


On November 19, 2003 at 07:54:58, Georg v. Zimmermann wrote:

>If someone has a larger (>100 pos or so)
>collection of mirrored fen position and could send them to me, I would be
>gratefull. I dont feel like writing my own routine for it right now.
>
>Georg

Under Linux/Unix/Cygwyn, maybe this shell-script is helpful. I'm not 100% sure
it works though. :)


#!/usr/bin/sh
# Reads FEN-strings from a file and prints the reversed FENs to stdout

while read fen ;do
	set $fen

	p1=`echo "$1" | sed -e
's:\(.*\)/\(.*\)/\(.*\)/\(.*\)/\(.*\)/\(.*\)/\(.*\)/\(.*\):\8/\7/\6/\5/\4/\3/\2/\1:'`
	p2=`echo "$2" | tr 'wb' 'bw'`
	p3=`echo "$3" | tr 'KQkq' 'kqKQ'`
	p4=`echo "$4" | tr '12345678' '87654321'`

	echo "$p1 $p2 $p3 $p4 $5 $6"
done



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.