From 2d4fc9d90f6d3166b69a4397c79727f447303960 Mon Sep 17 00:00:00 2001 From: DoomKitty87 Date: Mon, 21 Aug 2023 13:07:58 -0700 Subject: [PATCH] file imports --- web-app/seafoam/src/routegen.js | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 web-app/seafoam/src/routegen.js diff --git a/web-app/seafoam/src/routegen.js b/web-app/seafoam/src/routegen.js new file mode 100644 index 0000000..d751cd1 --- /dev/null +++ b/web-app/seafoam/src/routegen.js @@ -0,0 +1,50 @@ +const fs = require('fs'); + +const overallPads = []; +// Loading etherwarp pad coordinates +const padFile = fs.readFileSync('padsv3.txt', 'utf8'); +const padLines = padFile.trim().split('\n'); +for (const line of padLines) { + const [x, y, z] = line.split(' ').map(Number); + overallPads.push(x, y, z); +} + +const gemstoneData = fs.readFileSync('blockarraydatav3.txt', 'utf8'); +const blockData = []; +const lines = gemstoneData.trim().split('\n'); +for (let x = 0; x < 622; x++) { + blockData[x] = []; + for (let y = 0; y < 256; y++) { + blockData[x][y] = []; + const values = lines.shift().split(' ').map(Number); + blockData[x][y] = values; + } +} + +const gemDensities = []; +const densityFile = fs.readFileSync('densitylistv3.txt', 'utf8'); +const densityLines = densityFile.trim().split('\n'); +for (const line of densityLines) { + gemDensities.push(Number(line)); +} + +console.log(`Loaded ${overallPads.length / 3} pads.`); + +const desiredPathLength = 150; + +const jadecoordsx = 823; +const jadecoordsz = 202; + +const sectors = []; +for (let i = 0; i < 5; i++) { + for (let j = 0; j < 5; j++) { + const sector = []; + const cornerx = jadecoordsx + i * -128; + const cornerz = jadecoordsz + j * 128; + sector.push(cornerx); + sector.push(cornerz); + sector.push(cornerx - 128); + sector.push(cornerz + 128); + sectors.push(sector); + } +} \ No newline at end of file