Permalink
Browse files

Made cells act like unsigned 8 bit values.

  • Loading branch information...
1 parent 4b0eca7 commit f5bac65d0b65efaa92731df24e0f6c99155d19b3 @dwillie dwillie committed Aug 11, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 js/models.js
View
@@ -7,10 +7,16 @@ var Cell = Backbone.Model.extend({
value: 0
},
inc: function () {
- this.increase("value", 1);
+ if (this.get("value") == 255)
+ this.set("value", 0);
+ else
+ this.increase("value", 1);
},
dec: function () {
- this.increase("value", -1);
+ if (this.get("value") == 0)
+ this.set("value", 255)
+ else
+ this.increase("value", -1);
},
put: function (c) {
this.set("value", c.charCodeAt(0));

0 comments on commit f5bac65

Please sign in to comment.