Question about "shuffle" and "nocastle"

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

Volker Pittlik
Posts: 628
Joined: Wed Mar 08, 2006 9:10 pm
Location: Murten / Morat, Switzerland
Full name: Volker Pittlik

Re: Question about "shuffle" and "nocastle&am

Post by Volker Pittlik »

hgm wrote:And the -variant nocastle does not work because the engine says it does not know how to play nocastle? (Although in reality it does...)...
Possibly yes! It seems this "nocastle" transforms to a relict from the past. Almost all the "wild" positions are just legal positions on the board. Every engine with implemented "setboard" should be able to handle it correctly.

vp
Volker Pittlik
Posts: 628
Joined: Wed Mar 08, 2006 9:10 pm
Location: Murten / Morat, Switzerland
Full name: Volker Pittlik

Re: Question about "shuffle" and "nocastle&am

Post by Volker Pittlik »

Forget that script. It does the correct thing for a wrong reason. I'll post a corrected version later.

vp
Volker Pittlik
Posts: 628
Joined: Wed Mar 08, 2006 9:10 pm
Location: Murten / Morat, Switzerland
Full name: Volker Pittlik

Re: Question about "shuffle" and "nocastle&am

Post by Volker Pittlik »

Volker Pittlik wrote:...I'll post a corrected version later.
Should work now also on windows with cygwin

Code: Select all

#! /bin/bash
# Generate an opening position for the "wild2" chess variant
myName="wild2"
# Where to save the position
savepos="/tmp/wild2.fen"
# next line is one option for windows, comment it out if needed
# savepos="C:\Documents and Settings\All Users\Documents\wild2.fen"

# w=white, b=black
i=0
while [ $i -le 7 ]
do
	w[i]=" "
	b[i]=" "
	i=`expr $i + 1`
done

# find position for kings
row=$[$RANDOM%8]
w[$row]="K"
b[$row]="k"

# queens
while true
do
	row=$[$RANDOM%8]
	if [ "${w[$row]}" = " " ]; then
		w[$row]="Q"
		b[$row]="q"
		break
	else
		continue
	fi
done
# 2 rooks
while true
do
	row=$[$RANDOM%8]
	if [ "${w[$row]}" = " " ]; then
		w[$row]="R"
		b[$row]="r"
		break
	else
		continue
	fi
done
while true
do
	row=$[$RANDOM%8]
	if [ "${w[$row]}" = " " ]; then
		w[$row]="R"
		b[$row]="r"
		break
	else
		continue
	fi
done
# 2 bishops
while true
do
	row=$[$RANDOM%8]
	if [ "${w[$row]}" = " " ]; then
		w[$row]="B"
		b[$row]="b"
		break
	else
		continue
	fi
done
while true
do
	row=$[$RANDOM%8]
	if [ "${w[$row]}" = " " ]; then
		w[$row]="B"
		b[$row]="b"
		break
	else
		continue
	fi
done
# knights
i=0
while [ $i -le 7 ]
do
	if [ "${w[$i]}" = " " ]; then
		w[$i]="N"
		b[$i]="n"
	fi
	i=`expr $i + 1`
done
echo "${b[0]}${b[1]}${b[2]}${b[3]}${b[4]}${b[5]}${b[6]}${b[7]}\
/pppppppp/8/8/8/8/PPPPPPPP/\
${w[0]}${w[1]}${w[2]}${w[3]}${w[4]}${w[5]}${w[6]}${w[7]} \
w - - 0 1" >"$savepos"
# comment out the following to see the fen string
# cat "$savepos"

Code: Select all

#! /bin/bash
# Generate a startposition for chess variant "wild3"
# this is a comment
myName="wild3"
# Where to save the position
savepos="/tmp/wild3.fen"
# next line is one option for windows, comment it out if needed
# savepos="C:\Documents and Settings\All Users\Documents\wild3.fen"
i=0
while [ $i -le 7 ]
do
	w[i]=" "
	b[i]=" "
	i=`expr $i + 1`
done
# Position of kings
row=$[$RANDOM%8]
w[$row]="K"
b[$row]="k"

i=0
while [ $i -le 7 ]
do
	if [ "${w[$i]}" = " " ]; then
		piece=$[$RANDOM%4]
		case $piece in
			0) w[$i]="Q"; b[$i]="q" ;;
			1) w[$i]="R"; b[$i]="r" ;;
			2) w[$i]="B"; b[$i]="b" ;;
			3) w[$i]="N"; b[$i]="n" ;;
			*) echo "bug in $myName $piece, 1"; exit 1 ;;
		esac
	fi
	i=`expr $i + 1`
done 
echo "${b[0]}${b[1]}${b[2]}${b[3]}${b[4]}${b[5]}${b[6]}${b[7]}\
/pppppppp/8/8/8/8/PPPPPPPP/\
${w[0]}${w[1]}${w[2]}${w[3]}${w[4]}${w[5]}${w[6]}${w[7]} \
w - - 0 1" >"$savepos"
# comment out the following to see the fen string
# cat "$savepos"