1
0
mirror of https://github.com/PDP-10/its.git synced 2026-01-13 07:19:57 +00:00
PDP-10.its/doc/ms/cheg.desc
Lars Brinkhoff 0fecf17f15 MacHack VI with 340 display.
Type "FANCY<TAB>2<Return>" to get the 340 display chess board.
2018-08-16 09:50:43 +02:00

266 lines
11 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.pgn
.quote \
.nj
.ss
.psize 1000
.paperw 100
.pl 1000
.l 100
.fi
. CHEG is the CHess EndGame interpreter. The endgame program to
be interpreted is read in by the RENDG (Read ENDGame) command, which
may appear in a file to be RS'ed. The program is used only if EGSW
is positive. The format for an endgame program is as follows:
.sp 1
ENTRY a&b,c&d,e where a and c are each one of the following:
. K,N,B,R,2N,BN,2B,B2N,2BN,BR,RN,RB,2R,R2N,RBN,R2B,Q,QN,QB;
. b and d are each of the form "kP", where k is between 0 and 9; and
. e is of one of the forms "=m", "<m", ">m" where m is between -9 and 9.
. If k is 1 it may be omitted, and if b or d is 0P,
it and the preceding "&" may be omitted.
In addition, ",e" may be omitted.
.nf
tag: inst arg1,arg2,arg3
tag: inst arg1,arg2,arg3
.
.
.
ENTRY a&b,c&d,e
tag: inst arg1,arg2,arg3
.
.
.
END
.fi
.sp 1
The ENTRY pseudoinstruction says "start here if specified entry condition
is satisfied" where the entry condition specifies the types and numbers
of pieces and pawns on the board. The pieces, and the number of pawns if
specified, must match exactly with the condition of the board. The pieces
and pawns specified first are those of the side to move (hereafter called
"white"). e, if it is included, is a condition on the difference between
the number of white pawns and the number of black pawns. If more than one
ENTRY is satisfied, the first is used. If no entry condition is satisfied,
the endgame program is not used.
.break
Tags on instructions are optional, and are followed by : and the instruction
being tagged.
Instructions may take a variety of argument types. These are
.nf
1 read-only variable
2 written variable
3 variable used for both reading and writing within the same instruction
4 tag
5 condition
6 ordering operation
.fi
Variable values may be of one of the following types:
.nf
0 undefined
1 logical
2 integer
3 set (actually a vector) of variable values
4 piece
5 square
6 move
.fi
A literal of type 1, 2, or 3 may be specified by preceding the
desired value by ", e.g. "5, "(), "(1,2,(3)).
.break
A piece may be specified by a piece-valued variable, a square-valued
variable (specifying the piece on that square), or a
move-valued variable (specifying the piece being moved).
A square may be specified by a square-valued variable, a piece-valued
variable (specifying the location of that piece), or a
move-valued variable (specifying the square to which the
piece being moved is moved).
.sp 1
The following read-only variables are initially defined:
. X undefined except inside a subroutine where it is the
subroutine's argument, or during a plan where it is
the plan variable
. DEPTH current depth (in plies) of search
. LM set of legal moves
. PG set of pawn groups (a pawn group is a set of pawns separated from
all other pawns by files with no pawns on them)
. WK this and the 31 following are the pieces
on the board and are undefined otherwise
. WQ
. WR
. WR2
. WB
. WB2
. WN
. WN2
. WP
. WP2
. WP3
. .
. .
. .
. WP8
. BK
. .
. .
. .
. BP8
.sp 1
The following conditions are defined (negation of a condition is accomplished
by preceding its name by #):
. always true
. DEFD if defined
. =0 if integer = 0
. <0 if integer < 0
. >0 if integer > 0
. ODD if integer odd
. T if logical variable = T
. EMPTY if set variable = ()
. FAR if specified square is on opposite side of board from SIDE
. RF if specified square is on rook file
. NF if specified square is on knight file
. NNF if specified square is on knight file and on same side of board as SIDE
. SAFE if WP can be reached by WK before BK (simpleminded: doesn't check
if king moves are legal)
. KING if specified piece is king
. PAWN if specified piece is pawn
. QUEEN if specified piece is queen
. ROOK if specified piece is rook
. NIGHT if specified piece is knight
. BISH if specified piece is bishop
. PASSD if specified pawn is passed
. PDP if specified pawn is defended by a pawn
. WSQ if specified square is white
. WPC if specified piece is white
. CAPT if move is a capture
. OPP if move leaves WK at distant opposition to BK
. RWK= if move keeps WK on the same rank
.sp 1
The following order operations are defined (preceded by # for reverse ordering):
. no ordering specified
. DEEP move a > move b iff rank(move a) > rank(move b)
.sp 1
The following instructions are defined:
. BREAK constant,var1,var2 Print out the PC, the instruction
and the specified variables; then .VALUE. Program can
be resumed by $P.
. RETURN var Subroutine return of var.
. COND condition,tag1,tag2 If variable returned by subroutine
call to tag1 satisfies condition, go to tag2. Otherwise
continue with next instruction in sequence.
. CONDV condition,var,tag If var satisfies condition, go to tag.
Otherwise continue with next instruction in sequence.
. CONDT tag1,var,tag2 If subroutine call to tag1 with X
set to var returns T, go to tag2; if it returns F, continue
with next instruction in sequence.
. CONDF tag1,var,tag2 If subroutine call to tag1 with X
set to var returns F, go to tag1; if it returns T, continue
with next instruction in sequence.
. JUMP< var1,var2,tag If var1 < var2 go to tag. Otherwise
continue with next instruction in sequence.
. JUMP= similarly
. JUMP> similarly
. JUMP#< similarly (# means not)
. JUMP#= similarly
. JUMP#> similarly
. SET var1,tag,var2 Subroutine call to tag with var2 as argument X;
set var1 to value returned.
. SETV var1,var2 Set var1 to value of var2.
. SETSQ var1,var2,var3 Set var1 to square with rank var2 and file var3.
. SETMOV var1,var2,var3 Set var1 to move with piece specified by var2
and square specified by var3.
. EXCH var1,var2 Exchange the values of var1 and var2.
. ORDER var1,var2,order Exchange the values of var1 and var2 iff var1 > var2
according to order.
. PLAY var,cond,order Play the first move (according to order) in the
set given by var satisfying the condition cond. If there are no
such moves, continue to the next instruction.
A VALRUT or VALON should have been executed before
this instruction, and the last value thus given is
returned to the main Chess program.
. PLAYB var,cond,order Try all moves given by set var satisfying condition
cond. Moves are tried in order specified. The best move found is
played, and its value returned to the main program.
If there are no moves to try, continue to the next
instruction.
. TRY var,cond,order Try all moves given by set var satisfying condition
cond. Moves are tried in order specified. The best move found is
remembered along with its value.
. PLAN tag,var1,var2 Set plan to tag. This means that at
deeper levels of recursion with the same side to move,
the endgame program will be started at the tag instead
of using the ENTRY's to find the starting place. The
plan variable is set to the value of var2. Using the
specified plan, try all moves in the set var1.
. UNPLAN Don't use plan any more, and undefine the plan variable.
. DONE Return to main program with best move found by
TRYs and PLANs together with its value.
. RETBET var1,var2,var3 Return to main program with best move found by
TRYs and PLANs together with its value, if this value is better
for white than the value specified by var1,var2,var3.
. VALRET var1,var2,var3 Return to the main chess program the value
var1 winning chances, var2 losing chances, with certainty var3.
. VALRUT var1,var2,var3 Same as VALRET, but don't return if at top level.
. VALON var1 var2,var3 Same as VALRET, but don't ever return to chess program.
. LEAVE Return to main program for its evalulation and/or move.
. SELECT var1,tag,var2 Set var1 to the subset of var2 whose elements
give T when subroutine given by tag is called.
. SELECC var1,cond,var2 Set var1 to subset of var2 whose elements satisfy cond.
. PAIR var1,var2,var3 Set var1 to the set consisting of var2 followed by var3.
. MAP var1,tag,var2 Set var1 to the set obtained by substituting for
each element of var2 the value returned by the subroutine specified
by tag when given element as arg.
. MEMBER var1,var2,var3 Set var1 to T or F depending on whether or not var2
is an element of var3.
. MEMNUM var1,var2,var3 Set var1 to the least integer n such that var2 is the nth element of
var3, or 0 if var2 is not an element of var3.
. INTERS var1,var2,var3 Set var1 to the intersection of sets var2 and var3
where the elements are in the same order as those of var2.
. UNION var1,var2,var3 Set var1 to the union of sets var2 and var3
where the elements of var2 come first (and without reordering)
followed by the elements of var3-var2 in the order of var3.
. DIFFER var1,var2,var3 Set var1 to var2-var3 with the order
. of var2.
. APPEND var1,var2,var3 Set var1 to the set gotten by appending var3 to var2.
. PIECE var1,var2 Set var1 to piece specified by var2.
. SQUARE var1,var2 Set var1 to square specified by var2.
. SIDE var1,var2 Set var1 to side of board given by square specified by var2.
0 is kingside, 1 is queenside.
. RANK var1,var2 Set var1 to rank (with respect to white)
of square specified by var2.
. FILE var1,var2 Set var1 to file of square specified by var2.
. SCOLOR var1,var2 Set var1 to color of square specified by var2;
0 for white, 1 for black.
. PCOLOR var1,var2 Set var1 to color of piece specified by var2.
. MVDIST var1,var2,var3 Set var1 to king-move distance between squares specified
by var2 and var3.
. INSQ var1,var2,var3 Set var1 to T or F depending on whether or not
king specified by var2 is in square of pawn specified
by var3 (depends on side to move in usual way).
. OPP var1,var2 var3 Set var1 to T or F depending on whether or not
squares specified by var2 and var3 are in distant opposition.
. SQ>RNK var1,var2,const Set var1 to the square with same file as square specified
by var2, but with rank greater by const.
. CARD var1,var2 Set var1 to number of elements in var2.
. GETEL var1,var2,var3 Set var1 to the var3th element of var2. (Negative
var3 counts from right end of set.)
. SETEL var1,var2,var3 Set the var3th element of var2 to var1.
. INSERT var1,var2,var3 Insert var1 before the var3th element of var2.
. UNSERT var1,var2,var3 Remove and set var1 to the var3th element of var2.
. EXCHWE var1,var2,var3 Exchange var1 and the var3th element of var2.
. EXCHEL var1,var2,var3 Exchange the var2th and var3th elements of var1.
. NOR var1,var2,var3 Set var1 to logical nor of var2 and var3.
. OR var1,var2,var3 Set var1 to logical or of var2 and var3.
. AND var1,var2,var3 Set var1 to logical and of var2 and var3.
. ADD var1,var2,var3 Set var1 to sum of var2 and var3.
. SUB var1,var2,var3 Set var1 to difference of var2 and var3.
. MUL var1,var2,var3 Set var1 to product of var2 and var3.
. DIV var1,var2,var3 Set var1 to the quotient when var2 divided by var3.
. MOD var1,var2,var3 Set var1 to the remainder when var2 divided by var3.
. DIF var1,var2,var3 Set var1 to absolute value of difference of var2 and var3.
. MIN var1,var2,var3 Set var1 to minimum of var2 and var3.
. MAX var1,var2,var3 Set var1 to maximum of var2 and var3.
. ABS var1,var2 Set var1 to absolute value of var2.
.end