aboutsummaryrefslogtreecommitdiff
path: root/space.js
diff options
context:
space:
mode:
authorHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 14:35:45 -0500
committerHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 14:35:45 -0500
commit8810c883ff3b0b5709b9d7fb78e70ecec7211e94 (patch)
treeeddaf1cf6f75f5a32f31fc98204eb7ca69bdaa01 /space.js
parent05b56f4388f1cfec012acda92e5791a95d65ef69 (diff)
space.write relies on .loc; expanded jarvis response
Diffstat (limited to 'space.js')
-rw-r--r--space.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/space.js b/space.js
index c0cce60..0dffbca 100644
--- a/space.js
+++ b/space.js
@@ -49,11 +49,12 @@ function Space(){
}
}
}
- this.towrite = function(charoffset){ // Does no splitting or anything like that. Just returns a list of triplets for the write function
+
+ this.towrite = function(){ // Does no splitting or anything like that. Just returns a list of triplets for the write function
let writes = [];
- for (let line = 0; line < this.data.length; line++) for (let chr = 0; chr< this.data[line].length; chr++){
- if (this.data[line][chr] == '') continue;
- writes.push([[charoffset[0]+line,charoffset[1]+chr],this.data[line][chr]]);
+ for (let line = 0; line < this.data.length; line++) for (let chr = 0; chr < this.data[line].length; chr++){
+ if (this.data[line][chr] == '') continue; // Internal coding for "do not write"
+ writes.push([[this.loc[0]+line, this.loc[1]+chr],this.data[line][chr]]);
}
return writes;
}
@@ -99,7 +100,9 @@ function Space(){
}
}
}
- this.search = function(other){ //Returns first instance of a subspace (prioritized vertically then horizontally)
+
+ this.search = function(other){ //Returns first instance of `other` subspace (prioritized vertically then horizontally)
+ // Non-standard exclusion of this.loc
let loc = [];
for (let line=0; line<=this.data.length-other.data.length; line++){ for (let chr=0; chr<=this.data[line].length-other.data[0].length; chr++){
var match = true;