Skip to content

Instantly share code, notes, and snippets.

@vsoch
Last active March 21, 2021 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsoch/49650f92d0d3e04fcce813a39165165b to your computer and use it in GitHub Desktop.
Save vsoch/49650f92d0d3e04fcce813a39165165b to your computer and use it in GitHub Desktop.
My first logic program - am I a dinosaur (requires clingo)
% clingo dinosaur.lp
% These are blanket facts, statements that each of these is living
% I think these are called atoms
living(vanessa).
living(fernando).
living(maria).
% This tells use size of arms for each living thing
armsize(vanessa, "small").
armsize(fernando, "large").
armsize(maria, "small").
% A boolean to say we can roar!
canroar(vanessa).
% An entity is a dinosaur if they are living, have tiny arms, and can roar.
dinosaur(Entity) :- living(Entity), armsize(Entity, "small"), canroar(Entity).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment