redacted names

This commit is contained in:
Ben
2021-05-10 16:25:41 +01:00
parent 04a1a0ba36
commit 5d9221827b
8 changed files with 425 additions and 8 deletions

View File

@@ -1 +1 @@
COPYRIGHT 2021 BENJAMIN KYD - ALL RIGHTS RESERVED COPYRIGHT 2021 REDACTED - ALL RIGHTS RESERVED

3
TODO
View File

@@ -7,6 +7,9 @@
# Short term, coursework scope # Short term, coursework scope
☐ ANONYOMISE
☐ README
☐ Translate ☐ Translate
✔ Portuagese (Ines) @done(21-04-11 01:03) ✔ Portuagese (Ines) @done(21-04-11 01:03)
→ Update with new locales → Update with new locales

View File

@@ -8,7 +8,7 @@
"setup": "npm i", "setup": "npm i",
"test": "nodemon launchserver.js" "test": "nodemon launchserver.js"
}, },
"author": "Ben Kyd <benjaminkyd@gmail.com> (https://benkyd.co.uk)", "author": " REDACTED",
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {
"express": "^4.17.1" "express": "^4.17.1"

View File

@@ -6,7 +6,7 @@
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "Ben Kyd <benjaminkyd@gmail.com> (https://benkyd.co.uk)", "author": "REDACTED",
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {
"eslint": "^7.23.0", "eslint": "^7.23.0",

View File

@@ -8,7 +8,7 @@
"setup": "npm i", "setup": "npm i",
"test": "nodemon index.js" "test": "nodemon index.js"
}, },
"author": "Ben Kyd <benjaminkyd@gmail.com> (https://benkyd.co.uk)", "author": "REDACTED",
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {
"body-parser": "^1.19.0", "body-parser": "^1.19.0",

View File

@@ -264,10 +264,11 @@ function PlayTurn(gameuid, playeruid, turn)
const turninfo = gameNextTurn(gameuid); const turninfo = gameNextTurn(gameuid);
ActiveGames[gameuid].gamestates.push(turn); ActiveGames[gameuid].gamestates.push(turn);
ActiveGames[gameuid].turn = turninfo.newTurn;
ActiveGames[gameuid].turn = turninfo.newTotalTurn;
// give user new tiles // give user new tiles
console.log(game);
return [turn, turninfo]; return [turn, turninfo];
} }
@@ -276,9 +277,18 @@ function SkipTurn(gameuid, playeruid)
const turninfo = gameNextTurn(gameuid); const turninfo = gameNextTurn(gameuid);
// get last game state // get last game state
const turn = { const turn = {
playeruid: playeruid: playeruid,
turn: turninfo.newTurn,
turntype: 'SKIP',
outcome: {},
oldboardtiles: ActiveGames[gameuid].gamestates[ActiveGames[gameuid].gamestates.length - 1],
boardtiles: ActiveGames[gameuid].gamestates[ActiveGames[gameuid].gamestates.length - 1]
}; };
ActiveGames[gameuid].gamestates.push(turn);
ActiveGames[gameuid].turn = turninfo.newTurn;
ActiveGames[gameuid].turn = turninfo.newTotalTurn;
return [turn, turninfo]; return [turn, turninfo];
} }
@@ -286,10 +296,10 @@ function gameNextTurn(gameuid)
{ {
const playerCount = ActiveGames[gameuid].players.length; const playerCount = ActiveGames[gameuid].players.length;
let newTurn = ActiveGames[gameuid].turn += 1; let newTurn = ActiveGames[gameuid].turn += 1;
newTurn = ActiveGames[gameuid].turn % PlayerCount; newTurn = ActiveGames[gameuid].turn % playerCount;
const newTotalTurn = ActiveGames[gameuid].turntotal += 1; const newTotalTurn = ActiveGames[gameuid].turntotal += 1;
return { return {
turnplayer: ActiveGames[gameuid].players[ActiveGames[gameuid].turn], turnplayer: ActiveGames[gameuid].players[newTurn],
newTurn: newTurn, newTurn: newTurn,
newTotalTurn: newTotalTurn newTotalTurn: newTotalTurn
}; };

View File

@@ -436,6 +436,7 @@ function GamePlayTurn(socket, args)
io.to(nextuser).emit('game-your-turn'); io.to(nextuser).emit('game-your-turn');
} }
require('fs').appendFileSync('../turns-debug.json', JSON.stringify(Game.Logic.GetGameByUserUID(user.uid), null, 4));
} }
function GameExchangeTiles(socket, args) function GameExchangeTiles(socket, args)

403
turns-debug.json Normal file
View File

@@ -0,0 +1,403 @@
{
"uid": "UQWPWN",
"locale": "en",
"players": [
{
"uid": "4034e8f531d4ad69",
"name": "ben",
"activetiles": [
"E",
"R",
"I",
"F",
"I",
"E",
"U"
],
"score": 0
}
],
"turn": 1,
"turntotal": 1,
"gamestates": [
{
"playeruid": -1,
"turn": 0,
"turntype": "",
"outcome": {
"valid": false
},
"oldboardtiles": [],
"boardtiles": []
},
{
"playeruid": "4034e8f531d4ad69",
"turn": -1,
"turntype": "PLACE",
"outcome": {},
"oldboardtiles": [],
"boardtiles": [
{
"pos": {
"x": 5,
"y": 14
},
"modifier": "NONE",
"letter": "I",
"score": -1
},
{
"pos": {
"x": 6,
"y": 14
},
"modifier": "NONE",
"letter": "F",
"score": -1
},
{
"pos": {
"x": 7,
"y": 14
},
"modifier": "TW",
"letter": "I",
"score": -1
}
]
}
],
"tilebag": [
"E",
"E",
"E",
"E",
"E",
"E",
"E",
"E",
"E",
"E",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"I",
"I",
"I",
"I",
"I",
"I",
"I",
"O",
"O",
"O",
"O",
"O",
"O",
"O",
"O",
"N",
"N",
"N",
"N",
"N",
"N",
"R",
"R",
"R",
"R",
"R",
"T",
"T",
"T",
"T",
"T",
"T",
"L",
"L",
"L",
"L",
"S",
"S",
"S",
"S",
"U",
"U",
"U",
"D",
"D",
"D",
"D",
"G",
"G",
"G",
"B",
"B",
"C",
"C",
"M",
"M",
"P",
"P",
"F",
"H",
"H",
"V",
"V",
"W",
"W",
"Y",
"Y",
"K",
"J",
"X",
"Q",
"Z",
"_",
"_"
],
"tileset": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z"
]
}{
"uid": "UQWPWN",
"locale": "en",
"players": [
{
"uid": "4034e8f531d4ad69",
"name": "ben",
"activetiles": [
"E",
"R",
"I",
"F",
"I",
"E",
"U"
],
"score": 0
}
],
"turn": 2,
"turntotal": 2,
"gamestates": [
{
"playeruid": -1,
"turn": 0,
"turntype": "",
"outcome": {
"valid": false
},
"oldboardtiles": [],
"boardtiles": []
},
{
"playeruid": "4034e8f531d4ad69",
"turn": -1,
"turntype": "PLACE",
"outcome": {},
"oldboardtiles": [],
"boardtiles": [
{
"pos": {
"x": 5,
"y": 14
},
"modifier": "NONE",
"letter": "I",
"score": -1
},
{
"pos": {
"x": 6,
"y": 14
},
"modifier": "NONE",
"letter": "F",
"score": -1
},
{
"pos": {
"x": 7,
"y": 14
},
"modifier": "TW",
"letter": "I",
"score": -1
}
]
},
{
"playeruid": "4034e8f531d4ad69",
"turn": -1,
"turntype": "PLACE",
"outcome": {},
"oldboardtiles": [],
"boardtiles": [
{
"pos": {
"x": 8,
"y": 14
},
"modifier": "NONE",
"letter": "U",
"score": -1
}
]
}
],
"tilebag": [
"E",
"E",
"E",
"E",
"E",
"E",
"E",
"E",
"E",
"E",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"A",
"I",
"I",
"I",
"I",
"I",
"I",
"I",
"O",
"O",
"O",
"O",
"O",
"O",
"O",
"O",
"N",
"N",
"N",
"N",
"N",
"N",
"R",
"R",
"R",
"R",
"R",
"T",
"T",
"T",
"T",
"T",
"T",
"L",
"L",
"L",
"L",
"S",
"S",
"S",
"S",
"U",
"U",
"U",
"D",
"D",
"D",
"D",
"G",
"G",
"G",
"B",
"B",
"C",
"C",
"M",
"M",
"P",
"P",
"F",
"H",
"H",
"V",
"V",
"W",
"W",
"Y",
"Y",
"K",
"J",
"X",
"Q",
"Z",
"_",
"_"
],
"tileset": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z"
]
}