Skip to content

Commit

Permalink
Merge pull request #83 from doug-martin/master
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
doug-martin committed Oct 14, 2013
2 parents aa6cce7 + e58883d commit 00332c0
Show file tree
Hide file tree
Showing 67 changed files with 7,013 additions and 1,109 deletions.
4 changes: 0 additions & 4 deletions benchmark/manners/manners.nools
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ rule findSeating {
not(chosen : Chosen chosen.id == sid && chosen.guestName == leftGuestName && chosen.hobby == rightGuestHobby);
}
then {
console.log("findSeating");
assert(new Seating({
id : countValue,
pid : sid,
Expand All @@ -132,7 +131,6 @@ rule makePath {
not( p2 : Path p2.id == sid && p2.guestName == pathGuestName);
}
then {
console.log("makePath");
assert(new Path({id : sid, seat : pathSeat, guestName : pathGuestName}));
}
}
Expand All @@ -143,7 +141,6 @@ rule pathDone {
s : Seating s.path == false;
}
then {
console.log("pathDone");
modify(s, function(){
this.path = true;
});
Expand Down Expand Up @@ -171,7 +168,6 @@ rule continue {
c : Context c.state == 'check';
}
then {
console.log("continue");
modify(c, function(){this.state = 'assign'});
}
}
Expand Down
14 changes: 14 additions & 0 deletions benchmark/sendMoreMoney/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";

var nools = require("../../index"),
flow = nools.compile(__dirname + "/sendMoreMoney.nools");

var start = new Date(),
session;
console.log("starting");
(session = flow.getSession(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)).match().then(function () {
console.log("%dms", +(new Date()) - start);
session.dispose();
});


18 changes: 18 additions & 0 deletions benchmark/sendMoreMoney/sendMoreMoney.nools
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
rule SendMoreMoney {
when {
s : Number s != 0;
e : Number e != s;
n : Number n != s && n != e;
d : Number d != s && d != e && d != n;
m : Number m != 0 && m != s && m != e && m != n && m != d;
o : Number o != s && o != e && o != n && o != d && o != m;
r : Number r != s && r != e && r != n && r != d && r != m && r != o;
y : Number y != s && y != e && y != n && y != d && y != m && y != o && y != r
&& (s*1000 + e*100 + n*10 + d + m*1000 + o*100 + r*10 + e) == (m*10000 + o*1000 + n*100 + e*10 + y);
}
then {
console.log('pathDone', {s : s, e : e, n : n, d : d, m : m, o: o, r : r, y : y});
console.log((s*1000 + e*100 + n*10 + d + m*1000 + o*100 + r*10 + e));
console.log((m*10000 + o*1000 + n*100 + e*10 + y))
}
}
4 changes: 2 additions & 2 deletions benchmark/waltzDb/waltzDb.nools
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ rule visit_2j_2 {
// ; (write edge_label <bp> <p3> <n3> <id> (crlf))
// (make edge_label ^p1 <bp> ^p2 <p1> ^l_name <n1> ^l_id <id>)
// (make edge_label ^p1 <bp> ^p2 <p2> ^l_name <n2> ^l_id <id>))
rule visit_2j_0 {
rule visit_2j_3 {
when {
s : Stage s.value == 'VISITING_2J';
j : Junction j.visited == 'now' {name : name, basePoint : basePoint, p1 : p1, p2 : p2};
Expand Down Expand Up @@ -922,7 +922,7 @@ rule start_checking {
// -->
// (modify 1 ^value remove_label)
// (make illegal ^bp <bp> ^l_id <id>))
rule checking1 {
rule checking {
when {
stage : Stage stage.value == 'CHECKING';
junction : Junction junction.visited == 'check' {basePoint : basePoint};
Expand Down
1 change: 1 addition & 0 deletions docs-md/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* [Conways 2D](./examples/browser/conways_2d.html)
* [Conways 3D](./examples/browser/conways_3d.html)
* [Sudoku](./examples/browser/sudoku.html)
* [Fibonacci](./examples/browser/fibonacci.html)
* [Miss Manners](./examples/browser/manners.html)
* [Diagnosis](./examples/browser/diagnose.html)
12 changes: 12 additions & 0 deletions docs/History.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@



<h1>0.2.0 / 2013-10-14</h1>
<ul>
<li>Nools now supports true modify!!!<ul>
<li>This is a major leap forward for <code>nools</code> opening the door for more complex actions and expressions in the rules.</li>
</ul>
</li>
<li>Added support from for <code>from</code> conditions in the <code>rhs</code>.</li>
<li>Fixed issue <a href="https://github.com/C2FO/nools/issues/81">#81</a>.</li>
<li>Fixed issue <a href="https://github.com/C2FO/nools/issues/82">#82</a>.</li>
<li>Added new <code>sudoku</code> web example.</li>
<li>Added <a href="http://en.wikipedia.org/wiki/Verbal_arithmetic">Send More Money</a> benchmark see <a href="https://github.com/C2FO/nools/issues/78">#78</a>.</li>
</ul>
<h1>0.1.14</h1>
<ul>
<li>Fixed issue with async actions and early match termination.</li>
Expand Down
1 change: 1 addition & 0 deletions docs/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ <h2>Examples</h2>
<ul>
<li><a href="./examples/browser/conways_2d.html">Conways 2D</a></li>
<li><a href="./examples/browser/conways_3d.html">Conways 3D</a></li>
<li><a href="./examples/browser/sudoku.html">Sudoku</a></li>
<li><a href="./examples/browser/fibonacci.html">Fibonacci</a></li>
<li><a href="./examples/browser/manners.html">Miss Manners</a></li>
<li><a href="./examples/browser/diagnose.html">Diagnosis</a></li>
Expand Down
3 changes: 3 additions & 0 deletions docs/examples/browser/assets/array-extended.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions docs/examples/browser/assets/conways.css
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,23 @@ input[type="submit"], input[type="button"] {
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
}

.sudoku .col {
width: 50px;
height: 50px;
font-size: 30px;
vertical-align: middle;
text-align: center;
}

.sudoku .col.error {
background-color: rgba(255, 0, 0, 0.43);
}

.sudoku #grid{
width: 465px;
height: 470px;
}

.col.live {
background-color: black;
}
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/browser/rules/conways3d.nools
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ rule Transition {
if(cell.transition()){
emit("cell-transition", cell);
transitioned = true;
}else{
retract(cell);
}
});
emit("evaluate");
Expand Down
Loading

0 comments on commit 00332c0

Please sign in to comment.