Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

44
LINES

< > BotCompany Repo | #1025766 // ai_weightChangeBot_theory

JavaX fragment (include)

sS ai_weightChangeBot_theory() {
  ret [[
    import math
    
    theory validity {
      // a human weighs between 80 and 400 pounds
      $x is a human
        & $x weighs ($y pounds)
        => $y >= 80 & $y <= 400
        
      contradiction => say (That can't be right)
    }
    
    theory (weight change) {
      $x weighs ($y pounds)
        & last time $x weighed ($z pounds)
        => proc {
          if ($y < $z):
            say (That is great!)
          else if ($y > $z):
            say (Aw, too bad, tomorrow is another day.)
          else:
            say (Tomorrow will be better)
        }
    }
  
    theory (remember last weight) {
      $x weighs ($y pounds)
        => proc {
          unless contradiction:
            delete all (last time $x weighed ($z pounds))
            store      (last time $x weighed ($y pounds))
        }
    }
    
    theory (interpret input) {
      $x says (i weigh $y pounds)
        => $x weighs ($y pounds)
      
      $x says (my weight is $y pounds)
        => $x weighs ($y pounds)
    }
  ]];
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025766
Snippet name: ai_weightChangeBot_theory
Eternal ID of this version: #1025766/2
Text MD5: 5adf090764cf6375c2b3ee0b9bf0372f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-18 23:37:25
Source code size: 1109 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 219 / 261
Version history: 1 change(s)
Referenced in: [show references]