shit me it works
This commit is contained in:
154
server/report.20210510.203404.29448.0.001.json
Normal file
154
server/report.20210510.203404.29448.0.001.json
Normal file
@@ -0,0 +1,154 @@
|
||||
|
||||
{
|
||||
"header": {
|
||||
"reportVersion": 1,
|
||||
"event": "Allocation failed - JavaScript heap out of memory",
|
||||
"trigger": "FatalError",
|
||||
"filename": "report.20210510.203404.29448.0.001.json",
|
||||
"dumpEventTime": "2021-05-10T20:34:04Z",
|
||||
"dumpEventTimeStamp": "1620675244940",
|
||||
"processId": 29448,
|
||||
"cwd": "P:\\Uni\\U30221-Application-Programming\\server",
|
||||
"commandLine": [
|
||||
"C:\\Program Files\\nodejs\\node.exe",
|
||||
"index.js"
|
||||
],
|
||||
"nodejsVersion": "v12.16.1",
|
||||
"wordSize": 64,
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"componentVersions": {
|
||||
"node": "12.16.1",
|
||||
"v8": "7.8.279.23-node.31",
|
||||
"uv": "1.34.0",
|
||||
"zlib": "1.2.11",
|
||||
"brotli": "1.0.7",
|
||||
"ares": "1.15.0",
|
||||
"modules": "72",
|
||||
"nghttp2": "1.40.0",
|
||||
"napi": "5",
|
||||
"llhttp": "2.0.4",
|
||||
"http_parser": "2.9.3",
|
||||
"openssl": "1.1.1d",
|
||||
"cldr": "35.1",
|
||||
"icu": "64.2",
|
||||
"tz": "2019c",
|
||||
"unicode": "12.1"
|
||||
},
|
||||
"release": {
|
||||
"name": "node",
|
||||
"lts": "Erbium",
|
||||
"headersUrl": "https://nodejs.org/download/release/v12.16.1/node-v12.16.1-headers.tar.gz",
|
||||
"sourceUrl": "https://nodejs.org/download/release/v12.16.1/node-v12.16.1.tar.gz",
|
||||
"libUrl": "https://nodejs.org/download/release/v12.16.1/win-x64/node.lib"
|
||||
},
|
||||
"osName": "Windows_NT",
|
||||
"osRelease": "10.0.19041",
|
||||
"osVersion": "Windows 10 Pro",
|
||||
"osMachine": "x86_64",
|
||||
"cpus": [
|
||||
{
|
||||
"model": "Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz",
|
||||
"speed": 4200,
|
||||
"user": 38138500,
|
||||
"nice": 0,
|
||||
"sys": 40069531,
|
||||
"idle": 456379625,
|
||||
"irq": 5650218
|
||||
},
|
||||
{
|
||||
"model": "Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz",
|
||||
"speed": 4200,
|
||||
"user": 24136171,
|
||||
"nice": 0,
|
||||
"sys": 25101031,
|
||||
"idle": 485350312,
|
||||
"irq": 197062
|
||||
},
|
||||
{
|
||||
"model": "Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz",
|
||||
"speed": 4200,
|
||||
"user": 36622515,
|
||||
"nice": 0,
|
||||
"sys": 35968140,
|
||||
"idle": 461996859,
|
||||
"irq": 195187
|
||||
},
|
||||
{
|
||||
"model": "Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz",
|
||||
"speed": 4200,
|
||||
"user": 30077687,
|
||||
"nice": 0,
|
||||
"sys": 33668906,
|
||||
"idle": 470840906,
|
||||
"irq": 157343
|
||||
},
|
||||
{
|
||||
"model": "Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz",
|
||||
"speed": 4200,
|
||||
"user": 38422656,
|
||||
"nice": 0,
|
||||
"sys": 45939125,
|
||||
"idle": 450225718,
|
||||
"irq": 187234
|
||||
},
|
||||
{
|
||||
"model": "Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz",
|
||||
"speed": 4200,
|
||||
"user": 40894406,
|
||||
"nice": 0,
|
||||
"sys": 60784640,
|
||||
"idle": 432908453,
|
||||
"irq": 141875
|
||||
},
|
||||
{
|
||||
"model": "Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz",
|
||||
"speed": 4200,
|
||||
"user": 59644109,
|
||||
"nice": 0,
|
||||
"sys": 97409203,
|
||||
"idle": 377534187,
|
||||
"irq": 182906
|
||||
},
|
||||
{
|
||||
"model": "Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz",
|
||||
"speed": 4200,
|
||||
"user": 75688171,
|
||||
"nice": 0,
|
||||
"sys": 120512359,
|
||||
"idle": 338386968,
|
||||
"irq": 173359
|
||||
}
|
||||
],
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"name": "Ethernet",
|
||||
"internal": false,
|
||||
"mac": "10:7b:44:15:f2:69",
|
||||
"address": "fe80::1898:828c:2e38:4e69",
|
||||
"netmask": "ffff:ffff:ffff:ffff::",
|
||||
"family": "IPv6",
|
||||
"scopeid": 4
|
||||
},
|
||||
{
|
||||
"name": "Ethernet",
|
||||
"internal": false,
|
||||
"mac": "10:7b:44:15:f2:69",
|
||||
"address": "10.210.71.53",
|
||||
"netmask": "255.255.240.0",
|
||||
"family": "IPv4"
|
||||
},
|
||||
{
|
||||
"name": "Loopback Pseudo-Interface 1",
|
||||
"internal": true,
|
||||
"mac": "00:00:00:00:00:00",
|
||||
"address": "::1",
|
||||
"netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
|
||||
"family": "IPv6",
|
||||
"scopeid": 0
|
||||
},
|
||||
{
|
||||
"name": "Loopback Pseudo-Interface 1",
|
||||
"internal": true,
|
||||
"mac": "00:00:00:00:00:00",
|
||||
"address": "
|
||||
@@ -324,67 +324,158 @@ function PlayTurn(gameuid, playeruid, turn)
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(GetGameByUserUID(playeruid));
|
||||
|
||||
// process outcome
|
||||
const temptiles = turn.oldboardtiles.concat(turn.boardtiles);
|
||||
// algorithm for getting words
|
||||
let words = [];
|
||||
// let words = [];
|
||||
// for (const newpiece of diff)
|
||||
// {
|
||||
// const traverse = (frompiece, direction, word) => {
|
||||
// // check up, down, left, right for others
|
||||
// const check = (x, y) => {
|
||||
// for (const checkpiece of temptiles)
|
||||
// {
|
||||
// if (!checkpiece.visited) checkpiece.visited = false;
|
||||
// // console.log(checkpiece);
|
||||
// // there's a piece there
|
||||
// if (checkpiece.pos.x === x && checkpiece.pos.y === y && checkpiece.visited === false)
|
||||
// {
|
||||
// console.log(word);
|
||||
// temptiles[temptiles.indexOf(checkpiece)].visited = true;
|
||||
// console.log(temptiles);
|
||||
// return traverse(checkpiece, direction, word + checkpiece.letter);
|
||||
// }
|
||||
// return word;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (direction === 0)
|
||||
// {
|
||||
// let up = check(frompiece.pos.x , frompiece.pos.y + 1);
|
||||
// words.push(up);
|
||||
// }
|
||||
// if (direction === 0)
|
||||
// {
|
||||
// let right = check(frompiece.pos.x + 1, frompiece.pos.y );
|
||||
// words.push(right);
|
||||
// }
|
||||
// if (direction === 0)
|
||||
// {
|
||||
// let down = check(frompiece.pos.x , frompiece.pos.y - 1);
|
||||
// words.push(down);
|
||||
// }
|
||||
// if (direction === 0)
|
||||
// {
|
||||
// let left = check(frompiece.pos.x - 1, frompiece.pos.y );
|
||||
// words.push(left);
|
||||
// }
|
||||
|
||||
// return word;
|
||||
// }
|
||||
// // traverse from the piece in all directions
|
||||
// traverse(newpiece, 0, newpiece.letter);
|
||||
// traverse(newpiece, 1, newpiece.letter);
|
||||
// traverse(newpiece, 2, newpiece.letter);
|
||||
// traverse(newpiece, 3, newpiece.letter);
|
||||
// }
|
||||
// console.log(words);
|
||||
|
||||
// const traverse = (x, y, direction, acc) => {
|
||||
|
||||
// console.log(temptiles)
|
||||
// for (const checkpiece of temptiles)
|
||||
// {
|
||||
// if (direction === 0)
|
||||
// {
|
||||
// if (x === checkpiece.pos.x && y + 1 === checkpiece.pos.y)
|
||||
// {
|
||||
// return traverse(x, y + 1, direction, acc + checkpiece.letter);
|
||||
// }
|
||||
// }
|
||||
// if (direction === 1)
|
||||
// {
|
||||
// if (x + 1 === checkpiece.pos.x && y === checkpiece.pos.y)
|
||||
// {
|
||||
// return traverse(x + 1, y, direction, acc + checkpiece.letter);
|
||||
// }
|
||||
// }
|
||||
// if (direction === 2)
|
||||
// {
|
||||
// if (x === checkpiece.pos.x && y - 1 === checkpiece.pos.y)
|
||||
// {
|
||||
// return traverse(x, y - 1, direction, acc + checkpiece.letter);
|
||||
// }
|
||||
// }
|
||||
// if (direction === 3)
|
||||
// {
|
||||
// if (x - 1 === checkpiece.pos.x && y === checkpiece.pos.y)
|
||||
// {
|
||||
// return traverse(x - 1, y, direction, acc + checkpiece.letter);
|
||||
// }
|
||||
// }
|
||||
// return acc;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// for (const newpiece of diff)
|
||||
// {
|
||||
// let wordsFromPiece = [];
|
||||
// wordsFromPiece.push(traverse(newpiece.pos.x, newpiece.pos.y, 0, newpiece.letter));
|
||||
// wordsFromPiece.push(traverse(newpiece.pos.x, newpiece.pos.y, 1, newpiece.letter));
|
||||
// wordsFromPiece.push(traverse(newpiece.pos.x, newpiece.pos.y, 2, newpiece.letter));
|
||||
// wordsFromPiece.push(traverse(newpiece.pos.x, newpiece.pos.y, 3, newpiece.letter));
|
||||
// console.log(wordsFromPiece);
|
||||
// }
|
||||
|
||||
// Attempt #3 with 3 hours before the deadline
|
||||
|
||||
// no recursion this time
|
||||
|
||||
for (const newpiece of diff)
|
||||
{
|
||||
const traverse = (frompiece, direction, word) => {
|
||||
// check up, down, left, right for others
|
||||
const check = (x, y) => {
|
||||
for (const checkpiece of temptiles)
|
||||
{
|
||||
if (!checkpiece.visited) checkpiece.visited = false;
|
||||
// console.log(checkpiece);
|
||||
// there's a piece there
|
||||
if (checkpiece.pos.x === x && checkpiece.pos.y === y && checkpiece.visited === false)
|
||||
{
|
||||
console.log(word);
|
||||
temptiles[temptiles.indexOf(checkpiece)].visited = true;
|
||||
console.log(temptiles);
|
||||
return traverse(checkpiece, direction, word + checkpiece.letter);
|
||||
}
|
||||
return word;
|
||||
}
|
||||
}
|
||||
|
||||
if (direction === 0)
|
||||
{
|
||||
let up = check(frompiece.pos.x , frompiece.pos.y + 1);
|
||||
words.push(up);
|
||||
}
|
||||
if (direction === 0)
|
||||
{
|
||||
let right = check(frompiece.pos.x + 1, frompiece.pos.y );
|
||||
words.push(right);
|
||||
}
|
||||
if (direction === 0)
|
||||
{
|
||||
let down = check(frompiece.pos.x , frompiece.pos.y - 1);
|
||||
words.push(down);
|
||||
}
|
||||
if (direction === 0)
|
||||
{
|
||||
let left = check(frompiece.pos.x - 1, frompiece.pos.y );
|
||||
words.push(left);
|
||||
}
|
||||
let wordsFromPiece = [];
|
||||
|
||||
return word;
|
||||
const check = (x, y) => {
|
||||
for (const checkpiece of temptiles)
|
||||
{
|
||||
if (checkpiece.pos.x === x && checkpiece.pos.y === y)
|
||||
return checkpiece;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const directions = [
|
||||
{x: -1, y: 0},
|
||||
{x: 1, y: 0},
|
||||
{x: 0, y: -1},
|
||||
{x: 0, y: 1}
|
||||
];
|
||||
|
||||
for (let i = 0; i < 4; i++)
|
||||
{
|
||||
let word = '';
|
||||
const direction = directions[i];
|
||||
|
||||
let coords = {x: newpiece.pos.x, y: newpiece.pos.y};
|
||||
while(true)
|
||||
{
|
||||
const ret = check(coords.x, coords.y);
|
||||
// console.log(ret);
|
||||
if (ret === false)
|
||||
break;
|
||||
word += ret.letter;
|
||||
coords.x += direction.x;
|
||||
coords.y += direction.y;
|
||||
}
|
||||
if (word.length === 1) continue;
|
||||
wordsFromPiece.push(word);
|
||||
console.log(word);
|
||||
}
|
||||
// traverse from the piece in all directions
|
||||
traverse(newpiece, 0, newpiece.letter);
|
||||
traverse(newpiece, 1, newpiece.letter);
|
||||
traverse(newpiece, 2, newpiece.letter);
|
||||
traverse(newpiece, 3, newpiece.letter);
|
||||
|
||||
}
|
||||
console.log(words);
|
||||
|
||||
// process turn and allocate scores
|
||||
|
||||
// give user new tiles
|
||||
|
||||
// update tiles with scores
|
||||
turn.boardtiles = turn.oldboardtiles.concat(turn.boardtiles);
|
||||
@@ -402,6 +493,16 @@ function PlayTurn(gameuid, playeruid, turn)
|
||||
turn.boardtiles[tile].score = score;
|
||||
}
|
||||
|
||||
// process turn and allocate scores
|
||||
|
||||
// for every new word
|
||||
// calculate based on TL/DL/DW/TW and tile score the score
|
||||
// send to client
|
||||
|
||||
|
||||
// give user new tiles
|
||||
|
||||
|
||||
ActiveGames[gameuid].gamestates.push(turn);
|
||||
ActiveGames[gameuid].turn = turninfo.newTurn;
|
||||
ActiveGames[gameuid].turntotal = turninfo.newTotalTurn;
|
||||
|
||||
Reference in New Issue
Block a user