Added missing state class, and updated readme

This commit is contained in:
Lewis Hemens 2014-01-08 21:58:41 +00:00
parent cd144e7d63
commit b387e22c16
2 changed files with 59 additions and 0 deletions

18
README Normal file
View File

@ -0,0 +1,18 @@
Follow the following to get asciiflow running locally.
Clone closure-library at the same level as asciiflow2:
$git clone https://code.google.com/p/closure-library/
Update compile.sh script if neccessary and run it:
$./compile.sh
This may require chmod a+x on some files.
Run a simple web server:
$python -m SimpleHttpServer
Goto localhost:8000/root.html

41
js-lib/state.js Normal file
View File

@ -0,0 +1,41 @@
/**
* Classes holding the state of the ascii-diagram.
*/
goog.provide('asciiflow.State');
/**
* @constructor
*/
asciiflow.Cell = function() {
/** @type {string|null} */ // Uses the string "#" for lines.
this.value = null;
};
asciiflow.Cell.prototype.setValue = function(value) {
this.value = value;
};
/**
* @constructor
*/
asciiflow.State = function() {
/** @type {Array.<Array.<asciiflow.Cell>>} */
this.cells = new Array(asciiflow.State.MAX_SIZE);
for (var i = 0; i < this.cells.length; i++) {
this.cells[i] = new Array(asciiflow.State.MAX_SIZE);
for (var j = 0; j < this.cells[i].length; j++) {
this.cells[i][j] = new asciiflow.Cell();
// Hack: Just fill image with random stuff for now.
if ((i % 10 == 0) && (j % 10 == 0)) {
var jstr = ("" + j);
this.cells[i][j].setValue(jstr.substring(jstr.length-1,jstr.length));
}
}
}
};
/** @const */ asciiflow.State.MAX_SIZE = 1000;
asciiflow.State.prototype.blah = function() {
};