From 2e089810bfc7645dbe780b00cb88f933e64067bc Mon Sep 17 00:00:00 2001 From: Benjamin Kyd Date: Sun, 2 May 2021 01:45:11 +0100 Subject: [PATCH] Docs for gamestuff --- client/public/favicon.ico | Bin 0 -> 1150 bytes client/public/scrabble/network.js | 2 +- server/src/game-logic.js | 44 ++++++++++++++++++++++++++--- server/src/letter-distributions.js | 3 +- 4 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 client/public/favicon.ico diff --git a/client/public/favicon.ico b/client/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..7f4ba568046c8dadbcb3af544b8234cd68233634 GIT binary patch literal 1150 zcmY+DdrXs87{)&`HvP*OHaC{JxI`z0Nn8wUZZbtE*cQkrgBAviONdMY0Z~ZYl-sxr z%A`PBZdzqrR0L#5kt&%5Dk6{xtn~IlE3~DQ7DPy7o0Dg!b6ePV@;m3e?{}W(yx-+e zloM&&w^O8lkNVn~qTZw^Y9E25Nakgp3=~D~4Q_kM-|?pIbic((Fus&kuX*}g(JxOB zFSQ`K*Md`hR;1ruG@O(!6vf{#@8Nbnb7C}^sf=FhCN)K6D@@K8CYHLYlq(x&`fcE~ z8xhwzhm$??NFhFHvV}j=WQ(I|GFw#o9lJ}zV!{zLQ5@`>e1{-b5Yb(z6w zGJtnYkA#~>B>ZH=i7pdTNKF|s>uToR#pZ$myYEeUZOgv~wVLIl_39^&e;|5pn-Q$~ zX>b~JU<(HEWwRQwZL^4Ln?tH}9+|QQ6c5;G!H_-Cq3;|RqZ-xAN#e<+)$6h_-Kmv|^dkt@U9K(T#bJ)j91|$2{^Vkl1h(phRFy~eBz@p6U zw;-g^07jJ>OtBh%#K$M68#}!MvBT{nxCN$yktfB6(cgnv(r@Or*gPvnbX38Bk((no zt!2ne@DpnhAXb4@tpZb|#;50c;IhXPyAE@}C{ZAY_%a3KUDDZK1XDO(Jw^5>RE}eJ&}nSh<_gcmG6dJtU{(=dQlEd7rqv^F$~A9Lzav{d z*K)Sc2yTlW0m3P;iIyc+;y@f9Z@7JeUEX2v;N^fVQo+Am2^R727iupZEY-S{4Vm^9 z511Zi|7=89^9)!*6@p0ZEYUdL{VWphk%jm;r3QQ1$>d)cL7?N^RI1@!qAKtzpMI@w z)N(|iFxvBoo_ke~V6g_AdcsAru1o<|r4o$%9=L~`0=ra>&{`dWgqlAO7b%kt@pY7F zbRn95e}4V!z4?u(b`!!RdhjmO2$$#(TBikv5L){yg86;m)=eNnLL*qDHTzX)103H@ zGH!jVm0sa>o1RHp4C}g_;nn5DF6)b!>n4OZ=!wrXBCgPgZ#5vAJRgtD$^IjLBKiY| zKDymN0dOL0HT;fu9<6PJ+_63v)Y0pT^Fyl(8Mkdn?3hP9ITKNhGl(R7UN_z8Tc&&6 cp_h{rB!7kAnEyjA88<`1|6fidB;*qQ0wtk*Z2$lO literal 0 HcmV?d00001 diff --git a/client/public/scrabble/network.js b/client/public/scrabble/network.js index 2d210b8..d78410d 100644 --- a/client/public/scrabble/network.js +++ b/client/public/scrabble/network.js @@ -116,8 +116,8 @@ function onGameBegin(socket, args) return; } - + } diff --git a/server/src/game-logic.js b/server/src/game-logic.js index 17e6256..83b37c5 100644 --- a/server/src/game-logic.js +++ b/server/src/game-logic.js @@ -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) { } diff --git a/server/src/letter-distributions.js b/server/src/letter-distributions.js index e34c919..54b9a09 100644 --- a/server/src/letter-distributions.js +++ b/server/src/letter-distributions.js @@ -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,