

2=LOOKAHEAD.  Bill Daly.

define
	tstsum A,B,C
	slr R+nxt
	trn .+3
nxt,	0
	-0
	add spl
	sto .+1
	0
	tra ers
	tra R+nxt
	tra R+nxt
	tra R+nxt
	tra ers
	tra ers
	tra R+wck
	tra R+nxt
	tra R+nxt
	tra ers
	tra ers
	tra ers
dpc,	tra R+new
	tra ers		|second.  +15.
	tra R+nxt
	tra R+nxt
	tra R+nxt
	tra ers
	tra ers
	tra ers
	tra C
	tra R+nxt
	tra R+zbh
	tra ers
	tra ers
	tra ers
zbh,	clad g+331
	switch ppl,g+331
	trn R+nxt
	load tra B,lnu+nxa
	tra R+nxt
new,	switch ppl,g+340
	bkkeep
	tra R+nxt
wck,	branch R+nxt+1,A
	com
	sto R+nxt+1
	tra R+nxt
	terminate

define
	tstfix
	slr R+13
	cla
	sto tst+nxt+1
	com
	sto g+331
	adds slr g+340,tst+new+1
	add (add-slr
	llr (trn .+2
	tra wip
	cla
	0
	terminate

define
	lineup
	slr R+nxa
	llr (3
	anl
	slr R+nxa+1
	sto R+nxa+3
	shr
	shr
	sto R+nxa+2
	add (add g
	llr (tra R+sec
zzz,	sto ppl
	adds 214-add,.+7
	doad add
	add spl+1
	0
	tra tst
sec,	clad R+nxa+3
	acmk 17
	add (add g+40
	subrut R+zzz
	clad R+nxa+2
	acmk 14
	add R+nxa+1
	add (add g+20
	subrut R+zzz
	load -2,R+nxa+2
	clad R+nxa+3
	doad add g-100
	sto R+nxa+1
	trn R+oog+2
	add (add g+60
	llr (tra R+nxa
	tra R+zzz
oog,	clad R+nxa+1
	acmk 37
	add (add g+60
	subrut R+zzz
	clad R+nxa+1
	five shr
	sto R+nxa+1
	modify R+nxa+2,1
	trn R+oog
	clad R+nxa+1
	add (add g+113
	subrut R+zzz
nxa,	0
	0
	0
	0
	terminate

define
	compress
	add ppl+1
	sixx cyl
	add ppl+2
	terminate

define
	expand
	llr (77
	anl
	sixx shr
	terminate

define
	initlk
	load h-1,ppl
	load -h-1000,ppl+1
	subrut res
	load slr tst+nxt,tst
	load add h,mhp
	slr ela+scb
	cla
	sto plt+1
	sto ply
	sto ply+1
	sto ply+2
	sto ply+3
	sto ply+4
	sto ply+5
	sto ply+6
	sto ply+7
	sto ply+10
	sto ply+11
	sto ply+12
	sto ply+13
	sto ply+14
	sto ply+15
	sto ply+16
	terminate

define
	uppair
	slr ppl+2
	load tra tst+dpc,spl
	sto ppl+1
	load -3,ppl
	subrut upm
	subrut tsf
	add ppl+1
	load -6,spl+1
	subrut lnu
	clad ppl+2
	load -2,ppl
	subrut upm
	add ppl+2
	load -5,spl+1
	load tra tst+dpc+15,spl
	subrut lnu
	terminate

define
	wipeup
	slr .+6
	sto .+4
	adds -add,.+6
	cla
	0
	0
	clc
	0
	add .-4
	add (1
	tra R+1
	terminate

define
	dnpair
	slr ppl+1
	sto ppl+2
	load tra tst+nxt,tst+1
	load 5,spl+1
	subrut lnu
	load 6,spl+1
	clad ppl+1
	subrut lnu
	tadd ppl+1,slr g+114,.+5
	load 3,g+114
	tadd ppl+2,slr g+114,.+5
	load 3,g+114
	load trn tst+nxt+2,tst+1
	terminate

define
	lookup
	llr ply
	lac
	adds 1,ply
	adds slr ply,R+sco
	adds add-slr,.+3
	cla
	0		|add ply info
	sto ppl
	mask 370000
	slr ppl+1
	lal
	five cyl
	add mhp
	sto R+scb
	branch ppl,R+rev
	cla
scb,	0		|add new moves
	trn R+emv
	alr
	add ppl+1
	adds 400000,ppl+4
	lac
	expand		|lo 6 in lr=his  hi 6 in acc=mine
ren,	uppair
	llr ppl+4
sco,	0		|ply info is restored
	tra lsm
rev,	adds 407777,ppl+4
	expand
	slr ppl
	mask 77
	add ppl
	tra R+ren	|main flow is reentered
emv,	switch R+sco,.+3
	cal
	0		|ply info set =+0
	modify mhp,-40
	modify ply,-2
	trn R+ndt
zya,	clad R+sco
	doad add-slr-1
	trn R+oth
	acmk 7777
	expand
bki,	dnpair
	tra R
ndt,	trif -1,nwn
	tra R+zya
oth,	expand
	slr ppl
	mask 77
	add ppl
	tra R+bki
	terminate

define
	tomnbk
	switch ela+sco,R+3
	llr ppl+4
	0
	modify mhp,40
	adds -add,.+3
	clc
	0
	tra ela
	terminate

define
	lookwin
	load add ply+1,R+4
	cla
	sto pft+dff
	add ply+1
	trn .+3
	amz
lkf,	trn lkc
	expand
	slr ppl+1
	acmk 77
	adds slr g+114,.+3
	load 3,g+114
	tadd ppl+1,slr g+114,.+5
	load 3,g+114
	modify R+4,1
	tra R+2
	terminate

define
	decision
	branch R+dff,bla
	add ply+1
	trn R+1+dff
	expand
	slr ppl+1
	mask 77
	slr ppl+2
	llr ppl+1
	tra R+dc2
dff,	-0
	expand
	slr ppl+2
	mask 77
	slr ppl+1
dc2,	lac
	subrut wrm
	clad ppl+1
	load -3,ppl
	subrut upm
	cla
	write flex S
	write flex ugg
	write flex est
	write flex  yo
	write flex u m
	write flex ove
	write flex    
	add ppl+2
	subrut bnp
	load -2,ppl
	subrut upm
	cla
	write flex



	modify R+3,1
	tra lkc
	terminate

define
	winfix
	cal
	switch ela+sco,.+3
	llr ppl+4
	0
	tra lkw
	terminate

define
	chkwin
	switch ela+sco,.+6
	clad ppl+4
	mask 377777
	0
	add ela+scb
	doad 1
	com
	trn lkw
	load add g+340,R+pkr
	godo upl+12,lkc,cla
	branch g+331,R+pz
	branch g+332,.+3
	tra tmb+4
	tadd ela+scb,-add-1,.+5
	clc
	0
	tra lsm
pz,	modify mhp,40
	adds -add,R+pkq
	sto .+3
	cla
pkr,	add g+340
	0
	trn ela
	load 2,ppl
	subrut fnd
	compress
pkq,	0
	modify R+pkr,1
	modify R+pkq,1
	tra R+pkr-2
	terminate

define
	lookcl
	load g+214,ppl
	load -g-457,ppl+1
	llr (tra bck
	tra res
	terminate

define
	equality A,B
	clad A
	lpd
	add (-0
	trn B
	terminate

define
	listcheck
	llr (add g+340
	branch g+331,R+nbk
	slr R+fde+1
	load 1,ppl
	slr R+swb-1
	subrut fnd
	switch ppl+1,ppl+3
	modify mhp,40
	adds -add,R+st1
fde,	branch g+340,R+nnw
	load 2,ppl
	subrut fnd
	modify R+fde+1,1
	llr ppl+3
	equality ppl+2,R+eqa
	equality ppl+1,R+eqb
	lpd
	sixx cyl
	add ppl+2
st1,	0
	bkkeep
	tra R+fde
eqb,	lac
	switch ppl+2,ppl+1
	sto ppl+2
eqa,	cla
	compress
	adds 370000,ppl+4
	switch R+fde+1,R+fqe+1
	switch R+st1,R+st3
	tra R+fqe
nnw,	switch R+st1,R+st2
	clad ela+scb
	add R+swb-1
	perform
st2,	0
	trn R+swb
	expand
	slr ppl+2
	llr ppl+3
	sto ppl+1
	lpd
	trif 0,R+eqc
	equality ppl+2,R+eqd
	modify R+st2,1
	bymodi R+st2-1,R+swb-1
	tra R+st2-2
	1
swb,	clad .-1
	com
	sto .-4
	trn R+nnw+2
	cla
	sto ppl+4
	add mhp
	perform
bke,	trn R+bko
	modify ppl+4,10000
	modify R+bke-1,1
	tra R+bke-2
bko,	tadd ela+sco,1,.+5
	llr ppl+4
	0
	tra ela
eqc,	lac
	switch ppl+2,ppl+1
	sto ppl+2
eqd,	cla
	compress
	adds 370000,ppl+4
	switch R+swb-1,R+swt-1
	switch R+st2,R+st4
	clad R+st2-1
	tra R+st4-4
nbk,	add ply
	com
	add plt
	trn R+plr
	slr R+fqe+1
	modify mhp,40
	adds -add,R+st3
fqe,	branch g+340,R+nkn
	load 2,ppl
	subrut fnd
	compress
st3,	0
	bkkeep
	modify R+fqe+1,1
	tra R+fqe
nkn,	switch R+st3,R+st4
	clad ela+scb
	add R+swt-1
	perform
st4,	0
	trn R+swt
	modify R+st4,1
	bymodi R+st4-1,R+swt-1
	tra R+st4-2
	1
swt,	clad .-1
	com
	sto .-4
	trn R+nkn+2
	branch g+331,ela
	clad ppl+4
	mask 7777
	add R+st4
	sto .+4
	adds 1,.+5
	lac
	0
	clc
	0
	tra R+bke-4
plr,	slr R+la+1
	load slr ll,R+llt-1
	lac
	adds 1,R+llt+1
	load llr ll-1,R+lm
	clc
	sto ll
	sto ll+1
	sto plt+1
la,	branch g+340,R+le
	load 2,ppl
	subrut fnd
	switch ppl+1,ll
llt,	switch ppl+2,ll+1
	modify R+llt-1,2
	modify R+llt+1,2
	modify R+la+1,1
	tra R+la
le,	clad R+llt-1
	sto R+l2
	com
	adds slr-llr+2,R+lq-1
l1,	switch mhp,.+3
	cla
	0
	trn R+lq
	expand
l2,	0
	ala
	add R+l2
	adds 1,R+l2
	lcc
	trn R+l2
	modify R+l1+3,1
	tra R+l1+2
lzz,	lac
	adds 1,R+lm
	adds add-llr+1,R+lm+2
lm,	llr ll-1
	branch ll+1,R+lq+4
	lpd
	trif 0,R+leq
	modify R+lm+2,1
	tra R+lm+1
	0
lq,	switch R+l2,R+lq+3
	ala
	0
	llr R+lm
	lac
	add R+lq-1
	trn R+lzz
	modify ply,-1
	com
	add plt
	com
	trn R+ldf
	tadd R+lm,add-llr+2,R+lt1
	add (-1
lt2,	perform
	trn R+ldf
	ala
lt1,	0
	trn R+l3z
	lpd
	trif 0,R+lqe
	modify R+lt1,1
	cla
	tra R+lt1
l3z,	clad R+lt2+2
	add (2
	tra R+lt2-2
leq,	clad R+lm
	slr ppl+4
	llr (1
	lpd
	perform
	lal
	five cyl
	add ppl+4
	sto ppl+4
	tadd ela+sco,1,.+5
	llr ppl+4
	0
	tra lkw
lqe,	clad R+lt2+2
	add (llr-add
	tra R+leq+2
ldf,	modify ela+sco,1
	clad ply
	tra ela+zya-1
	terminate

define
	yesorno A,B
	wait
	lac
	add (4000
	split .+2,A
	add (127777
	com
	trn R
	zero B
	tra R
	terminate

define
	testch A,B,C
	lac
	add (A
	com
	trn .+7
	add (-0
	split .+2,.+5
	clad (C
	tra B
	terminate

define
	listen
	cla
	sto ppl
	wait
	testch 7777,R+chu,0
	testch 253777,R+chu,1
	testch 303777,R+chu,2
	testch 343777,R+chu,3
	testch 323777,R+chu,4
	testch 263777,R+chu,5
	testch 223777,R+chu,6
	testch 243777,R+chu,7
che,	cla
	write flex    
	tra R
chu,	add ppl
	trn R+sce
	cyl
	cyl
	cyl
	adds trn,ppl
	tra R+2
sce,	cll
	sto ppl
	yesorno R+che,R+wat
wat,	cal
	add ppl
	terminate

define
	octpnt
	slr R+ax
	sto R+ax+1
	shr
	shr
	shr
	doad add R+ax+2
	pna
	add R+ax+1
	acmk 7
	doad add R+ax+2
	pna
	add R+ax+1
ax,	0
	0
	char r0
	char r1
	char r2
	char r3
	char r4
	char r5
	char r6
	char r7
	terminate

define
	maximum A
	clad A+2
	com
	add A+3
	trn .+5
	switch A+3,A+2
	switch A+1,A
	terminate

define
	genmove
	slr R+awa
	cla
spc,	add g+114
	ala
	add .-2
	adds 1,.-3
	trif add g+214,.+4
	clc
	tra R+awa
	lac
	trn R+1
	clad R+spc
	trif add g+115,.+3
awa,	0
	com
	tra .-2
	terminate

define
	tstst1
	slr R+ncd
	adds tra .+21,.+4
	clad spl+7
	0
	tra ers		|-12, 040
	tra R+ncd	|-11, 031
	tra R+ncd	|-10, 022
	tra R+ncd	| -9, 013
	tra ers		| -8, 004
	tra ers
	tra ers		| -6, 130
	tra R+ncd	| -5, 121
	tra R+ncd	| -4, 112
	tra ers		| -3, 103
	tra ers
	tra ers
	tra R+cp2	|  0, 220
	tra R+ncd	|  1, 211
	tra R+cm2	|  2, 202
	tra ers
	tra ers
	tra ers
	tra R+cp1	|  6, 310
	tra R+cm1	|  7, 301
	tra ers
	tra ers
	tra ers
	tra ers
	tra R+cpm	| 12, 400
cp1,	add R+ncd+1
	tra R+ncd-1
cp2,	add R+ncd+2
	tra R+ncd-1
cm1,	add R+ncd+3
	tra R+ncd-1
cm2,	add R+ncd+4
	tra R+ncd-1
cpm,	add R+ncd+5
	sto spl+7
ncd,	0
	10		|310
	1		|220
	6		|301
	40		|202
	2		|400
	terminate

define
	reverse
	branch g+114,R+s1
	modify R+1,1
	trif add g+214,R
	load add g+114,R+1
	tra lkc
s1,	llr (1
	lpd
	ala
	add R+1
	adds slr-add,.+2
	0
	tra R+3
	terminate


	start beg

m