Created
February 12, 2017 04:26
-
-
Save PyroLagus/150e69ff775e22d101f3a4328c5950ad to your computer and use it in GitHub Desktop.
Revisions
-
PyroLagus created this gist
Feb 12, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ function Point(x, y) { this.x = x; this.y = y; } Point.prototype = { west: function() { return new this(this.x-1, this.y); }, east: function() { return new this(this.x+1, this.y); }, north: function() { return new this(this.x, this.y-1); }, south: function() { return new this(this.x, this.y+1); }, moveWest: function() { this.x--; }, moveEast: function() { this.x++; }, moveNorth: function() { this.y--; }, moveSouth: function() { this.y++; } };