-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathterraformsDrawingGrabber.js
More file actions
33 lines (30 loc) · 973 Bytes
/
Copy pathterraformsDrawingGrabber.js
File metadata and controls
33 lines (30 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// copies the grid
let gridCopy = [];
// etherscan ready array
let etherscanArray = [];
// parse over each array in the 32x32 grid
for (i in grid) {
// start with a blank string
let indexCopy = "";
// iterate over the grids index
for (x in grid[i]) {
// if it's not a blank space, copy the drawing and add it to the grid
if (classIds.indexOf(grid[i][x].activeClass) > -1) {
indexCopy += classIds.indexOf(grid[i][x].activeClass.toString());
// otherwise, add a blank space to the array
} else {
indexCopy += 9;
}
}
// push the string to the grid
gridCopy.push(indexCopy);
}
// creates the etherscan ready array
for (let i = 0; i < gridCopy.length - 1; i += 2) {
let concatenatedHeight = "";
concatenatedHeight = gridCopy[i] + gridCopy[i + 1];
// converts it to a BigInt for ease of entry into etherscan
etherscanArray.push(BigInt(concatenatedHeight));
}
// logs output for user to copy
console.log(etherscanArray);