Docs for gamestuff

This commit is contained in:
Benjamin Kyd
2021-05-02 01:45:11 +01:00
parent e283f82fc3
commit 2e089810bf
4 changed files with 43 additions and 6 deletions

BIN
client/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -116,8 +116,8 @@ function onGameBegin(socket, args)
return;
}
}

View File

@@ -7,23 +7,58 @@ const Helpers = require('./helpers.js');
/*
GAME OBJECT
{
// reference UID
// Reference UID (of lobby)
uid: uid,
locale: en,
players: [{
uid: uid,
name: username,
activetiles: [tile: {
tile: tile,
letter: letter,
score: int
}],
score: int
}],
// index of players whos turn it is
// Index of players whos turn it is
turn: int,
// Array of GAMESTATEs, latest at head of array
gamestates: [],
tilebag: [],
tileset: []
}
GAMESTATE OBJECT
{
// UID of the player that played the turn
playeruid: uid,
turn: int,
// Generated after turn is processed
outcome: {
valid: bool,
points: pointsgained,
words: [{
word: word,
points: points,
tiles: [{
pos: {x: x, y: y},
modifier: modifier,
letter: letter,
score: int
}]
}],
}
oldboardtiles: [{
pos: {x: x, y: y},
modifier: modifier,
letter: letter,
score: int
}]
boardtiles: [{
pos: {x: x, y: y},
modifier: modifier,
letter: letter,
score: int
}]
}
NOTES
- The locale is the language of the *owner of the lobby*, the dictionary
will reflect this language choice
@@ -31,6 +66,7 @@ NOTES
score thing in letter-distributions.js TILEBAG is not to be confused
with tileset as those are active game tiles and are modified as turns
are played
- A GAMESTATE refers to a turn
*/
let ActiveGames = [];
@@ -88,7 +124,7 @@ NOTES
returning an error or a validation object including the next players
turn
*/
function PlayTurn(game, turn)
function PlayTurn(gameuid, playeruid, newstate)
{
}

View File

@@ -15,10 +15,11 @@ DISTRIBUTIONS OBJECT
...
]
}
NOTES
- TODO: JSON-ise it
*/
let Distributions = [];
Distributions['en'] = {
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'],
blanktiles: 2,