aboutsummaryrefslogtreecommitdiff
path: root/space.js
diff options
context:
space:
mode:
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;