Develop the demo novel a bit.
Chris Pressey
6 years ago
71 | 71 |
* (+) Consider what it would take to add a predicate that evaluates to whether
|
72 | 72 |
a given action has been taken previously or not.
|
73 | 73 |
* (+) Consider macros.
|
|
74 |
* Digits and -'s in atoms.
|
74 | 75 |
* Output scenarios to JSON.
|
75 | 76 |
* Python 3 support.
|
76 | 77 |
* Allow comments in source file. Probably `#` or `//`.
|
1 | 1 |
|
2 | 2 |
for line in sys.stdin:
|
3 | 3 |
l = line.strip()
|
|
4 |
l = l.replace('_', ' ')
|
4 | 5 |
if l:
|
5 | 6 |
sys.stdout.write("{} ".format(l))
|
6 | 7 |
else:
|
0 | 0 |
#!/bin/sh
|
1 | 1 |
|
2 | |
samovar settings.samovar scenes.samovar --min-events=12 | python formatter.py
|
|
2 |
THIS_SCRIPT=`realpath $0`
|
|
3 |
cd `dirname $THIS_SCRIPT`
|
|
4 |
samovar settings.samovar scenes.samovar --seed=0 --min-events=40 > events.txt
|
|
5 |
python formatter.py < events.txt > novel.md
|
|
6 |
cat novel.md
|
|
7 |
wc -w novel.md
|
|
8 |
|
0 | |
scenario Actors {
|
1 | |
[actor(α),item(β),~holding(α,β)] α picks up the β. [holding(α,β)]
|
2 | |
[actor(α),item(β),holding(α,β)] α puts down the β. [~holding(α,β)]
|
3 | |
actor(Ignatz).
|
4 | |
actor(Molly).
|
|
0 |
scenario Rules {
|
|
1 |
[actor(?A),item(?I),unheld(?I)] ?A picked up the ?I. [holding(?A,?I),!unheld(?I)]
|
|
2 |
[actor(?A),item(?I),holding(?A,?I)] ?A put down the ?I. [holding(?A,?I),unheld(?I)]
|
|
3 |
|
|
4 |
[actor(?A),!sitting(?A)] ?A walked around the room. []
|
|
5 |
[actor(?A),!sitting(?A),seat(?S),empty(?S)] ?A sat down on the ?S. [sitting(?A),sitting_on(?A,?S),!empty(?S)]
|
|
6 |
[actor(?A),sitting(?A),sitting_on(?A,?S)] ?A leaned back in the ?S. []
|
|
7 |
[actor(?A),sitting(?A),sitting_on(?A,?S)] ?A got up and stretched. [!sitting(?A),!sitting_on(?A,?S),empty(?S)]
|
5 | 8 |
}
|
6 | 9 |
|
7 | |
scenario ChapterI {
|
8 | |
import Brickyard.
|
9 | |
import Actors.
|
|
10 |
scenario SceneOne {
|
|
11 |
import SittingRoom.
|
|
12 |
import Rules.
|
|
13 |
|
|
14 |
actor(Pranehurst).
|
|
15 |
actor(Scurthorpe).
|
|
16 |
actor(Throgmorton).
|
|
17 |
|
|
18 |
shocked(Throgmorton).
|
10 | 19 |
|
11 | 20 |
goal [].
|
12 | 21 |
}
|
13 | 22 |
|
14 | |
scenario ChapterII {
|
15 | |
import DiningRoom.
|
16 | |
import Actors.
|
|
23 |
scenario SceneTwo {
|
|
24 |
import GardenShed.
|
|
25 |
import Rules.
|
|
26 |
|
|
27 |
actor(Pranehurst).
|
|
28 |
actor(Scurthorpe).
|
|
29 |
actor(Throgmorton).
|
|
30 |
|
|
31 |
shocked(Throgmorton).
|
17 | 32 |
|
18 | 33 |
goal [].
|
19 | 34 |
}
|
0 | |
scenario Brickyard {
|
1 | |
item(brick).
|
2 | |
item(glass).
|
|
0 |
scenario SittingRoom {
|
|
1 |
prop(desk).
|
|
2 |
prop(bookshelf).
|
|
3 |
prop(window).
|
|
4 |
prop(grandfather_clock).
|
|
5 |
prop(leather_chair).
|
|
6 |
|
|
7 |
seat(leather_chair).
|
|
8 |
empty(leather_chair).
|
|
9 |
|
|
10 |
item(newspaper).
|
|
11 |
item(whiskey).
|
|
12 |
item(brandy).
|
|
13 |
item(pocket_watch).
|
|
14 |
|
|
15 |
unheld(newspaper).
|
|
16 |
unheld(whiskey).
|
|
17 |
unheld(brandy).
|
|
18 |
unheld(pcoket_watch).
|
3 | 19 |
}
|
4 | 20 |
|
5 | |
scenario DiningRoom {
|
6 | |
item(table).
|
7 | |
item(chair).
|
|
21 |
scenario GardenShed {
|
|
22 |
prop(workbench).
|
|
23 |
prop(window).
|
|
24 |
prop(bags_of_potting_soil).
|
|
25 |
|
|
26 |
seat(bags_of_potting_soil).
|
|
27 |
empty(bags_of_potting_soil).
|
|
28 |
|
|
29 |
item(oilcan).
|
|
30 |
item(wrench).
|
|
31 |
item(screwdriver).
|
|
32 |
|
|
33 |
unheld(oilcan).
|
|
34 |
unheld(wrench).
|
|
35 |
unheld(screwdriver).
|
8 | 36 |
}
|