home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / educaton / inf_src.arc / WEKNOW.C < prev   
C/C++ Source or Header  |  1986-03-14  |  2KB  |  66 lines

  1.  
  2.  
  3. /*****************************************************************
  4. **                                **
  5. **      Inference -- (C) Copyright 1985 George Hageman    **
  6. **                                **
  7. **        user-supported software:                **
  8. **                                **
  9. **            George Hageman                **
  10. **            P.O. Box 11234                **
  11. **            Boulder, Colorado 80302            **
  12. **                                **
  13. *****************************************************************/
  14.  
  15. /*****************************************************************
  16. **    
  17. **    weKnow(antecedent,&predicate) 
  18. **
  19. **    routines searches both knownTrue and knownFalse
  20. **    stacks to determine whether the antecedent is known.
  21. **
  22. **    the return value of the routine is TRUE if known and FALSE otherwise
  23. **
  24. **    the predicate is set to the "true" value of the antecedent according
  25. **    to whether its phase is TRUE or FALSE and its .flag indicator.
  26. **
  27. *****************************************************************/
  28.  
  29. #include "expert.h"
  30. #include "inference.h"
  31.  
  32. int    weKnow(antecedent,p_value)
  33.     int antecedent,*p_value ;
  34. {
  35. if(known(antecedent,knownTrue,numTrue) == TRUE )
  36.     switch(ruleBuff[antecedent].flag)
  37.         {
  38.         case STRING_TRUE:
  39.         case STRING_TRUE_HYP:
  40.         case ROUTINE_TRUE:
  41.         case ROUTINE_TRUE_HYP:
  42.             *p_value = TRUE ;
  43.             return(TRUE)  ;
  44.         case STRING_FALSE:
  45.         case ROUTINE_FALSE :
  46.             *p_value = FALSE ;
  47.             return(TRUE) ;
  48.         }
  49. if(known(antecedent,knownFalse,numFalse) == TRUE )
  50.     switch(ruleBuff[antecedent].flag)
  51.         {
  52.         case STRING_TRUE:
  53.         case STRING_TRUE_HYP:
  54.         case ROUTINE_TRUE:
  55.         case ROUTINE_TRUE_HYP :
  56.             *p_value = FALSE ;
  57.             return(TRUE) ;
  58.         case STRING_FALSE:
  59.         case ROUTINE_FALSE:
  60.             *p_value = TRUE ;
  61.             return(TRUE)  ;
  62.         }
  63. return(FALSE) ;
  64. }
  65.  
  66.