Skip to content

Commit

Permalink
Merged 3.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cdot committed Jan 12, 2023
2 parents 90df38e + 7526bb6 commit 597e5fa
Show file tree
Hide file tree
Showing 107 changed files with 2,987 additions and 1,237 deletions.
19 changes: 16 additions & 3 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,25 @@ the following fields:
[other applications](https://www.speedguide.net/port.php?port=9093)
+ `games` : Path to the directory where games files will be stored,
relative to the root of the installation. Defaults to `games`.
+ `defaults` : A structure containing defaults to apply to new games and the UI for new users.
+`edition` : The string name of the default edition when creating new games. Game editions can be found in the `editions` directory. Default is `English_Scrabble`.
+ `maxAge`: maximum age of a game, in milliseconds. Where it has been longer than this since the game was last interacted with, the game will be pruned. If this is missing or <= 0, games never time out.
+ `game_defaults` : A structure containing defaults to apply to new games.
+ `edition` : The string name of the default edition when creating new games. Game editions can be found in the `editions` directory. Default is `English_Scrabble`.
+ `dictionary` : The default dictionary when creating new games. Note that the robot player requires a dictionary. Dictionaries can be found in the 'dictionaries' directory. Default is `CSW2019_English`.
+ `timerType` : Type of timer to use. This can be one of `Game timer` to impose a time limit on the entire game, or `Turn timer` to limit a single turn. Default is to have no timer.
+ `timeAllowed` : Time limit for a move or for the game, in minutes. If `timerType` is `Game timer` defaults to 25 minutes, and to 1 minute for `Turn timer`.
+ `timePenalty` : Points lost per minute over `timeAllowed`. Only used if `timerType` is `Game timer`. Default is 5 points per minute.
+ `challengePenalty` : The type of penalty to apply for a failed challenge. One of `Miss next turn`, `Lose points`, or `Lose points per word`. Default is `Miss next turn`.
+ `penaltyPoints` : The score penalty to apply for a failed challenge. Only used if `challengePenalty` is `Lose points` or `Lose points per word`.
`wordCheck`: `Check words after play` to check plays against the dictionary, `Reject unknown words` to reject plays that are not in the dictionary with no penalty. Default is no check.
+ `predictScore` : true or false. Whether or not to show the predicted score from tiles placed so far. Default is `true`.
+ `minPlayers` Least number of players must have joined before this game can start. Must be at least 2, default is `2`.
+ `maxPlayers` : Most number of players who can join a game. Default is no limit.
+ `allowUndo` : Whether or not to allow players to undo previous moves without penalty. Default is `false`.
+ `allowTakeBack` : Whether or not to allow players to take back their most recent move without penalty, so long as the next player hasn't challenged or played. Default is `true`.
+ `user_defaults` : Defaults that control the user's UI.
+ `notification` : Whether to generate UI notifications. Notifications require HTTPS. Defaults to `false`.
+ `jqTheme` : Name of one of the jQuery user interface themes.
+ `theme` : Layout theme, must be the name of a file in `css` (no extension). Defaults to `default`.
+ `jqTheme` : Name of one of the jQuery user interface themes.
+ `warnings` : Whether to generate warning sounds. Defaults to `true`.
+ `cheers` : Whether to generate end of game cheers / groans. Defaults to `true`.
+ `tile` : Whether to make a click when a tile is placed. Defaults to `true`.
Expand Down
2 changes: 1 addition & 1 deletion bin/checkStrings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*Copyright (C) 2019-2022 The Xanado Project https://github.com/cdot/Xanado
/*Copyright (C) 2019-2023 The Xanado Project https://github.com/cdot/Xanado
License MIT. See README.md at the root of this distribution for full copyright
and license information. Author Crawford Currie http://c-dot.co.uk*/

Expand Down
53 changes: 35 additions & 18 deletions bin/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

/*Copyright (C) 2019-2022 The Xanado Project https://github.com/cdot/Xanado
/*Copyright (C) 2019-2023 The Xanado Project https://github.com/cdot/Xanado
License MIT. See README.md at the root of this distribution for full copyright
and license information. Author Crawford Currie http://c-dot.co.uk*/

Expand Down Expand Up @@ -28,35 +28,52 @@ import { ServerPlatform } from "../src/server/ServerPlatform.js";
global.Platform = ServerPlatform;

import { Server } from "../src/server/Server.js";
import { Game } from "../src/game/Game.js";

// Default configuration.
const DEFAULT_CONFIG = {
port: 9093,
games: path.join(__dirname, "..", "games"),
defaults: {
edition: "English_Scrabble",
dictionary: "CSW2019_English",
notification: false,
theme: "default",
warnings: true,
cheers: true,
tile_click: true,
maxAge: 14 * 24 * 60 * 60 * 1000,
game_defaults: Game.DEFAULTS,
// Defaults passed to the UI without processing by the server
user_defaults: {
notification: false,
theme: "default",
jqTheme: "pepper-grinder",
warnings: true,
cheers: true,
tile_click: true,
one_window: false,
turn_alert: true
}
};

// Populate sparse config structure with defaults from DEFAULT_CONFIG
function addDefaults(config, from) {
for (const field in from) {
if (typeof config[field] === "undefined")
config[field] = from[field];
else if (typeof from[field] === "object") {
if (typeof config[field] !== "object")
throw Error(typeof config[field]);
addDefaults(config[field], from[field]);
function addDefaults(config) {
// Compatibility with < 3.2.0, which only had "defaults"
if (config.defaults && !config.game_defaults) {
config.game_defaults = {};
xfer(DEFAULT_CONFIG.game_defaults, config.defaults, config.game_defaults);
}
if (config.defaults && !config.user_defaults) {
config.user_defaults = {};
xfer(DEFAULT_CONFIG.user_defaults, config.defaults, config.user_defaults);
}

function xfer(fields, from, to) {
for (const field in fields) {
if (typeof to[field] === "undefined")
to[field] = from[field];
else if (typeof from[field] === "object") {
if (typeof to[field] !== "object")
throw Error(typeof to[field]);
xfer(fields[field], from[field], to[field]);
}
}
}

xfer(DEFAULT_CONFIG, DEFAULT_CONFIG, config);
return config;
}

Expand Down Expand Up @@ -104,7 +121,7 @@ if (options.config) {
});
}

p.then(json => addDefaults(JSON.parse(json), DEFAULT_CONFIG))
p.then(json => addDefaults(JSON.parse(json)))

.then(config => {

Expand Down
63 changes: 45 additions & 18 deletions css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ body {
box-shadow: 0 0 0.5em #000000;
}

.hidden {
display: none;
}

/* Strip all padding off element */
.no-padding {
padding: 0 !important;
Expand Down Expand Up @@ -401,7 +397,7 @@ body.games-ui {
}

/* Button for making a play */
#playBlock .turn-button {
#playBlock .action-button {
font-size: 130%;
}

Expand Down Expand Up @@ -559,6 +555,7 @@ body.games-ui {
}

#playRack .controls {
display: flex;
}

/* rack control buttons - shuffle, unplace */
Expand Down Expand Up @@ -607,19 +604,25 @@ body.games-ui {

/*------------ LANDSCAPE SCREEN ------------*/
@media screen and (min-aspect-ratio: 1/1) {
#playBlock .action-button {
display: inline-block;
}

#playRack .action-button {
display: none!important;
}

/* Wraps UI components in game */
.game-interface {
display: flex;
justify-content: center;
flex-wrap: nowrap;
}
}

/*------------ PORTRAIT SCREEN ------------*/

@media screen and (max-aspect-ratio: 1/1) {
/* Position the signin block above the board */
#signinBlock {
position: absolute;
top: 0;
left: 0;
width: 100%;
margin-top: 3px;
}

/* Override Surface - Board is full width */
#board {
Expand All @@ -636,6 +639,29 @@ body.games-ui {
width: 100%;
margin: 0;
}

#playBlock .action-button {
display: none;
}

#playRack .action-button {
display: inline-block;
}

/* Wraps UI components in game */
.game-interface {
display: flex;
justify-content: center;
flex-wrap: wrap;
}

/* Position the signin block above the board */
#signinBlock, #standalone_topBlock {
position: absolute;
top: 0;
left: 2vw;
width: 95vw;
}
}

/* A surface is a table, the cells of which represent the squares */
Expand Down Expand Up @@ -937,11 +963,12 @@ body.games-ui {
}
}

/* Wraps UI components in game */
.game-interface {
display: flex;
justify-content: center;
flex-wrap: wrap;
.hidden {
display: none !important;
}

.smaller {
font-size: smaller;
}

/* Override jquery-ui for shuffle and take-back buttons */
Expand Down
Binary file modified dictionaries/British_English.dict
Binary file not shown.
3 changes: 0 additions & 3 deletions dictionaries/British_English.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44333,9 +44333,6 @@ PLUSES
PLUSH
PLUSHER
PLUSHEST
PLUSHIER
PLUSHIEST
PLUSHY
PLUSSES
PLUTOCRACIES
PLUTOCRACY
Expand Down
Binary file modified dictionaries/Oxford_5000.dict
Binary file not shown.
1 change: 0 additions & 1 deletion dictionaries/Oxford_5000.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17062,7 +17062,6 @@ NEARSIGHTEDNESS
NEAT
NEATER
NEATEST
NEATH
NEATLY
NEATNESS
NECK
Expand Down
4 changes: 2 additions & 2 deletions dist/client/AddRobotDialog._ClientGamesUI.js

Large diffs are not rendered by default.

Loading

0 comments on commit 597e5fa

Please sign in to comment.