diff --git a/README.md b/README.md index bb6a2af..bbf8b31 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ * (+) Consider what it would take to add a predicate that evaluates to whether a given action has been taken previously or not. * (+) Consider macros. +* Digits and -'s in atoms. * Output scenarios to JSON. * Python 3 support. * Allow comments in source file. Probably `#` or `//`. diff --git a/eg/demo-novel/.gitignore b/eg/demo-novel/.gitignore new file mode 100644 index 0000000..b445fc7 --- /dev/null +++ b/eg/demo-novel/.gitignore @@ -0,0 +1,2 @@ +events.txt +novel.md diff --git a/eg/demo-novel/formatter.py b/eg/demo-novel/formatter.py index 69e7b66..923d0ab 100644 --- a/eg/demo-novel/formatter.py +++ b/eg/demo-novel/formatter.py @@ -2,6 +2,7 @@ for line in sys.stdin: l = line.strip() + l = l.replace('_', ' ') if l: sys.stdout.write("{} ".format(l)) else: diff --git a/eg/demo-novel/generate.sh b/eg/demo-novel/generate.sh index bc52967..3d4bc4f 100755 --- a/eg/demo-novel/generate.sh +++ b/eg/demo-novel/generate.sh @@ -1,3 +1,9 @@ #!/bin/sh -samovar settings.samovar scenes.samovar --min-events=12 | python formatter.py +THIS_SCRIPT=`realpath $0` +cd `dirname $THIS_SCRIPT` +samovar settings.samovar scenes.samovar --seed=0 --min-events=40 > events.txt +python formatter.py < events.txt > novel.md +cat novel.md +wc -w novel.md + diff --git a/eg/demo-novel/scenes.samovar b/eg/demo-novel/scenes.samovar index 70ed7b6..06430ef 100644 --- a/eg/demo-novel/scenes.samovar +++ b/eg/demo-novel/scenes.samovar @@ -1,20 +1,35 @@ -scenario Actors { - [actor(α),item(β),~holding(α,β)] α picks up the β. [holding(α,β)] - [actor(α),item(β),holding(α,β)] α puts down the β. [~holding(α,β)] - actor(Ignatz). - actor(Molly). +scenario Rules { + [actor(?A),item(?I),unheld(?I)] ?A picked up the ?I. [holding(?A,?I),!unheld(?I)] + [actor(?A),item(?I),holding(?A,?I)] ?A put down the ?I. [holding(?A,?I),unheld(?I)] + + [actor(?A),!sitting(?A)] ?A walked around the room. [] + [actor(?A),!sitting(?A),seat(?S),empty(?S)] ?A sat down on the ?S. [sitting(?A),sitting_on(?A,?S),!empty(?S)] + [actor(?A),sitting(?A),sitting_on(?A,?S)] ?A leaned back in the ?S. [] + [actor(?A),sitting(?A),sitting_on(?A,?S)] ?A got up and stretched. [!sitting(?A),!sitting_on(?A,?S),empty(?S)] } -scenario ChapterI { - import Brickyard. - import Actors. +scenario SceneOne { + import SittingRoom. + import Rules. + + actor(Pranehurst). + actor(Scurthorpe). + actor(Throgmorton). + + shocked(Throgmorton). goal []. } -scenario ChapterII { - import DiningRoom. - import Actors. +scenario SceneTwo { + import GardenShed. + import Rules. + + actor(Pranehurst). + actor(Scurthorpe). + actor(Throgmorton). + + shocked(Throgmorton). goal []. } diff --git a/eg/demo-novel/settings.samovar b/eg/demo-novel/settings.samovar index 0c7d27f..b0558eb 100644 --- a/eg/demo-novel/settings.samovar +++ b/eg/demo-novel/settings.samovar @@ -1,9 +1,37 @@ -scenario Brickyard { - item(brick). - item(glass). +scenario SittingRoom { + prop(desk). + prop(bookshelf). + prop(window). + prop(grandfather_clock). + prop(leather_chair). + + seat(leather_chair). + empty(leather_chair). + + item(newspaper). + item(whiskey). + item(brandy). + item(pocket_watch). + + unheld(newspaper). + unheld(whiskey). + unheld(brandy). + unheld(pcoket_watch). } -scenario DiningRoom { - item(table). - item(chair). +scenario GardenShed { + prop(workbench). + prop(window). + prop(bags_of_potting_soil). + + seat(bags_of_potting_soil). + empty(bags_of_potting_soil). + + item(oilcan). + item(wrench). + item(screwdriver). + + unheld(oilcan). + unheld(wrench). + unheld(screwdriver). }