;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; RECOGNIZE_PLAYER_WIN_RHS ; ; FILE NAME: RECOGNIZE_PLAYER_WIN_RHS.LSP ; CREATION DATE: 11/17/89 ; AUTHOR: Frederick S. Schebor ; REVISIONS: ; Date Initials Reason for Revision ; PURPOSE: A right-hand-knowledge source which will determine who one a tic-tac-toe game. ; METHOD: Get blackboard data. ; DECLARATION: parameter type I/O purpose ; --------- ---- --- ------- ; DEFUN recognize_player_win_rhs ( No passed parameters ; ) ; REFERENCED ROUTINES: ; get_blackboard_data ; lib$signal ; put_blackboard_data ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ( DEFINE-EXTERNAL-ROUTINE ( get_blackboard_data :FILE "SHAREABLE_BLACKBOARD_UTILITIES" :TYPE-CHECK T ) ( logical_name :LISP-TYPE STRING ) ( equivalence_name :LISP-TYPE STRING :ACCESS :IN-OUT ) ( number_of_characters :LISP-TYPE INTEGER :VAX-TYPE :WORD :ACCESS :IN-OUT ) ( return_status :LISP-TYPE INTEGER :ACCESS :IN-OUT ) ) ( DEFINE-EXTERNAL-ROUTINE ( lib$signal :FILE "LIBRTL" :TYPE-CHECK T ) ( condition_value :LISP-TYPE INTEGER ) ) ( DEFINE-EXTERNAL-ROUTINE ( put_blackboard_data :FILE "SHAREABLE_BLACKBOARD_UTILITIES" :TYPE-CHECK T ) ( logical_name :LISP-TYPE STRING ) ( equivalence_name :LISP-TYPE STRING ) ( return_status :LISP-TYPE INTEGER :ACCESS :IN-OUT ) ) ( DEFUN recognize_player_win_rhs ( ) ( FORMAT T "~% The game is over! ~%" ) ( SETF next_move " " ) ( SETF number_of_characters 0 ) ( SETF return_status 0 ) ( CALL-OUT get_blackboard_data "NEXT_MOVE" next_move number_of_characters return_status ) ( COND ( ( NOT ( EQUAL return_status 1 ) ) ( CALL-OUT lib_signal return_status ) ) ;Determine who won ( ( STRING-EQUAL next_move "COMPUTER" :end1 number_of_characters ) ( FORMAT T " You have won. ~%" ) ) ( T ( FORMAT T " I have won. ~%" ) ) ) ( CALL-OUT put_blackboard_data "NEXT_MOVE" "NONE" return_status ) ;Update the blackboard ( CALL-OUT put_blackboard_data "GAME_STATUS" "DISPLAY_FINAL_BOARD" return_status ) ; " " " )