#C11a.txt: Generalized Backgammon, two fair dice of r-faces #home-size h, and board-size b #(In usual Backgammon r=6, h=6, b=24) #convention: position is a list of length b #L1, and L2 are both lists of length b and #Pos=[L1,L2,bar1,bar2] #(bar1=number of white pieces on the bar, bar2=...) #NO DOUBLING CUBE #roll=List of Dice Faces [i,j] Help:=proc() : print(` IsBearOff(POS,b,h) `): end: #IsBearOff(POS,b,h): are all the pieces of player #home yet? IsBearOff:=proc(POS,b,h) local i: if POS[3]>0 then RETURN(false): fi: evalb({true,seq(evalb(POS[1][i]=0),i=h+1..b)}={true}): end: #LegalMoves(POS,b,h,i): all the legal moves #for player POS[1] (White) #with one-die roll i from position POS with #board-size b and home-size h LegalMoves1:=proc(POS,b,h,i) local S: if not IsBearOff(POS,b,h) then fi: end: