: PNUMBER BL EVALUATE ; ( -- u ) : PDROPS 0 ?DO BL 2DROP LOOP ; ( u -- ) : PROTOVER 1 PDROPS \ Winboard version; "protover 2" CR S~ feature done=1 time=1 myname="TSCP 6" usermove=1 colors=0~ TYPE CR ; : ACCEPTED 1 PDROPS ; \ "accepted done" reaction to feature command : REJECTED 1 PDROPS ; \ "rejected done" reaction to feature command : QUIT BYE ; : RANDOM ; \ "Human touch" not supported 0 VALUE timeLeft 0 VALUE inc : CALCTIME timeLeft 5 RSHIFT inc + 1 MAX st ; : TIME PNUMBER #100 / TO timeLeft ; : OTIM 1 PDROPS ; : LEVEL PNUMBER ( moves ) \ level 40 5 0 == "moves" "time" "increment variables" PNUMBER #60 * TO timeLeft PNUMBER ?DUP 0= IF timeLeft OVER 1 MAX / THEN TO inc DROP ; DEFER USERMOVE : (GO) calctime THINK pv @ ?DUP IF CR ." move " DUP .move CR makeMove DROP ELSE CR ." go: pv == 0" ENDIF .result? DROP ; : @mv inmv IF \ ( "e2e4" -- ) if promoting: "a7a8Q" makeMove IF .result? 0= IF (go) EXIT ENDIF CR ." TSCP in usermove :: makeMove had .result? = TRUE" ELSE CR ." TSCP in usermove :: Can't move there." ENDIF ELSE CR ." TSCP in usermove :: inmv failed." ENDIF ; : @domv inmv IF \ ( "e2e4" -- ) for forcing a sequence of moves makeMove IF .result? DROP ELSE CR ." TSCP in usermove :: Can't move there." ENDIF ELSE CR ." TSCP in usermove :: inmv failed." ENDIF ; : GO ['] @mv IS USERMOVE (GO) ; \ ask the computer to choose move : NEW init_board ['] @mv IS USERMOVE ; \ set a default board and reset everything : FORCE ['] @domv IS USERMOVE ; \ check move but don't do anything : XBOARD ['] NOOP 'PROMPT ! \ standard initialization ['] NOOP 'TAIL ! ['] winboard_ct IS checkTime ['] @mv IS USERMOVE 5 SD ; : SD BL EVALUATE sd ; \ set depth : ST BL EVALUATE st ; \ set time : POST ; \ These commands would turn on and off "pondering", thinking on the \ opponent's time. If pv @ is the move chosen by the computer, then pv \ CELL+ @ is the expected response. Assume the opponent made that move, \ and start analysing it. If the opponent responds with that move, you \ have saved the time the opponent spent thinking (you can make a move \ right away, or continue searching). Otherwise, stop searching, \ replace the expected move with the actual move and search normally. : hard ; : easy ; : ? ; \ in checkTime: Break off thinking and do a move \ EOF