From ff5d7c22bc6aab5bd44ae50d58bb58f26b304521 Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Tue, 3 Feb 2015 01:28:41 -0500 Subject: [PATCH 1/3] Add scripts field to package.json Run with `npm start` and `npm test` --- .gitignore | 7 ++++++- SpecRunner.html | 10 +++++----- index.html | 2 +- package.json | 10 +++++++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 637d92c..d1148ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ .idea/ -node_modules/ \ No newline at end of file +node_modules/ +*.log + +# OS garbage +Thumbs.db +~* diff --git a/SpecRunner.html b/SpecRunner.html index e83bc91..d867ca5 100644 --- a/SpecRunner.html +++ b/SpecRunner.html @@ -5,17 +5,17 @@ Jasmine Spec Runner v2.0.0 - + - - - + + + - + diff --git a/index.html b/index.html index a76fda6..27f7b33 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + diff --git a/package.json b/package.json index 44b17da..b447dab 100644 --- a/package.json +++ b/package.json @@ -11,20 +11,24 @@ "email": "atiraodhner@gmail.com" } ], - "main": "./src/ordial.js", "repository": { "type": "git", "url": "https://github.com/segfaultsoftware/ordial.git" }, + "main": "index.html", + "scripts": { + "start": "index.html", + "test": "SpecRunner.html" + }, "dependencies": { "backbone": "1.1.x", "jquery": "2.1.x", "underscore": "1.5.x" }, "devDependencies": { - "less": "~2.0.0", "grunt": "~0.4.5", "grunt-contrib-watch": "~0.6.1", - "grunt-exec": "~0.4.6" + "grunt-exec": "~0.4.6", + "less": "~2.0.0" } } From f999227af2a11cc5b938795753dacab94bc7458c Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Tue, 3 Feb 2015 16:38:51 -0500 Subject: [PATCH 2/3] Use ACE Editor --- Gruntfile.js | 4 ++-- index.html | 34 ++++++++++++++++++++++++++-------- package.json | 4 +++- src/css/ordial.css | 10 +++++++--- src/less/ordial.less | 11 ++++++++--- 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 545763a..d6571eb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,11 +9,11 @@ module.exports = function(grunt) { } }, exec: { - compile_less:'lessc ./src/less/ordial.less ./src/css/ordial.css' + compile_less: 'lessc ./src/less/ordial.less ./src/css/ordial.css' } }); grunt.loadNpmTasks('grunt-exec'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ['watch']); -} \ No newline at end of file +}; \ No newline at end of file diff --git a/index.html b/index.html index 27f7b33..f3ac890 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,6 @@ - + + +Ordial @@ -25,6 +27,7 @@ + @@ -64,19 +67,19 @@

Active Code

var rob = new Critter({mind: new CritterMind({decisionTree: moveForwardOrThink})}); function getCoord() { - return Math.floor(Math.random() * 10); + return Math.floor(Math.random() * 10); } function getCoords() { - return {x: getCoord(), y: getCoord()}; + return {x: getCoord(), y: getCoord()}; } for(var i = 0; i < 50; i++) { - world.place(new Resource(), getCoords()); + world.place(new Resource(), getCoords()); } for(var i = 0; i < 50; i++) { - var blocker = new Rock(); - world.place(blocker, getCoords()); + var blocker = new Rock(); + world.place(blocker, getCoords()); } rob.direction = _.sample(CardinalDirection.ALL_DIRECTIONS); @@ -98,7 +101,7 @@

Finding food

}; var turnLeftOrTurnRight = new DecisionNode(isNothingToTheLeftOfMe, Critter.Actions.TURN_LEFT, Critter.Actions.TURN_RIGHT); - var eatItOrThink = new DecisionNode(isThingInFrontOfMeEdible, Critter.Actions.MOVE_FORWARD, turnLeftOrTurnRight + var eatItOrThink = new DecisionNode(isThingInFrontOfMeEdible, Critter.Actions.MOVE_FORWARD, turnLeftOrTurnRight); var moveForwardOrThink = new DecisionNode(isSomethingInFrontOfMe, eatItOrThink, Critter.Actions.MOVE_FORWARD); var rob = new Critter({mind: new CritterMind({decisionTree: moveForwardOrThink})}); @@ -127,7 +130,7 @@

Zig Zag

var zig = [Critter.Actions.TURN_RIGHT, Critter.Actions.MOVE_FORWARD, Critter.Actions.DECREMENT_COUNTER]; var zag = [Critter.Actions.TURN_LEFT, Critter.Actions.MOVE_FORWARD, Critter.Actions.INCREMENT_COUNTER]; var toZigOrToZagThatIsTheQuestion = function(stimuli, vitals) { - return vitals.counter === 0; + return vitals.counter === 0; }; var zigZag = new DecisionNode(toZigOrToZagThatIsTheQuestion, zig, zag); anna = new Critter({mind: new CritterMind({decisionTree:zigZag })}); @@ -148,3 +151,18 @@

Turn, Run, and Make Babies

world.place(new Resource(), {x: 3, y: 4}); + + diff --git a/package.json b/package.json index b447dab..19429e9 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "main": "index.html", "scripts": { "start": "index.html", - "test": "SpecRunner.html" + "test": "SpecRunner.html", + "grunt": "grunt" }, "dependencies": { "backbone": "1.1.x", @@ -27,6 +28,7 @@ }, "devDependencies": { "grunt": "~0.4.5", + "grunt-cli": "^0.1.13", "grunt-contrib-watch": "~0.6.1", "grunt-exec": "~0.4.6", "less": "~2.0.0" diff --git a/src/css/ordial.css b/src/css/ordial.css index 334ce54..8eec9ec 100644 --- a/src/css/ordial.css +++ b/src/css/ordial.css @@ -116,7 +116,11 @@ padding: 0; border: 0; } -textarea { - width: 500px; - height: 200px; +textarea, +.ace_editor { + width: 900px; + height: 220px; +} +body { + font-family: sans-serif; } diff --git a/src/less/ordial.less b/src/less/ordial.less index f313c20..6c5bf34 100644 --- a/src/less/ordial.less +++ b/src/less/ordial.less @@ -3,7 +3,12 @@ @import 'rock'; @import 'world'; -textarea { - width: 500px; - height: 200px; +textarea, +.ace_editor { + width: 900px; + height: 220px; +} + +body { + font-family: sans-serif; } From f21b2e69cf25d20186d7598823ee295b8f21c39e Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Sat, 28 Feb 2015 16:44:03 -0500 Subject: [PATCH 3/3] Use opener --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 19429e9..dcb1ca9 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ }, "main": "index.html", "scripts": { - "start": "index.html", - "test": "SpecRunner.html", + "start": "opener index.html", + "test": "opener SpecRunner.html", "grunt": "grunt" }, "dependencies": { @@ -27,6 +27,7 @@ "underscore": "1.5.x" }, "devDependencies": { + "opener": "~1.4.0", "grunt": "~0.4.5", "grunt-cli": "^0.1.13", "grunt-contrib-watch": "~0.6.1",