From 8810c883ff3b0b5709b9d7fb78e70ecec7211e94 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Fri, 27 Dec 2019 14:35:45 -0500 Subject: space.write relies on .loc; expanded jarvis response --- space.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'space.js') 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; -- cgit