Skip to content

Commit

Permalink
shuffle around multiplayer constants
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey-wu committed May 24, 2024
1 parent 50a4295 commit 6a1c93e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 48 deletions.
46 changes: 0 additions & 46 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,50 +65,7 @@ const ALTERNATE_SUBCATEGORY_TO_CATEGORY = {
};
const ALTERNATE_SUBCATEGORIES_FLATTENED = Object.keys(ALTERNATE_SUBCATEGORY_TO_CATEGORY);

/**
* List of multiplayer permanent room names.
*/
const PERMANENT_ROOMS = [
{
name: 'hsquizbowl',
categories: CATEGORIES,
subcategories: SUBCATEGORIES_FLATTENED,
},
{
name: 'collegequizbowl',
categories: CATEGORIES,
subcategories: SUBCATEGORIES_FLATTENED,
},
{
name: 'literature',
categories: ['Literature'],
subcategories: ['American Literature', 'British Literature', 'Classical Literature', 'European Literature', 'World Literature', 'Other Literature'],
},
{
name: 'history',
categories: ['History'],
subcategories: ['American History', 'Ancient History', 'European History', 'World History', 'Other History'],
},
{
name: 'science',
categories: ['Science'],
subcategories: ['Biology', 'Chemistry', 'Physics', 'Other Science'],
},
{
name: 'fine-arts',
categories: ['Fine Arts'],
subcategories: ['Visual Fine Arts', 'Auditory Fine Arts', 'Other Fine Arts'],
},
{
name: 'trash',
categories: ['Trash'],
subcategories: ['Trash'],
},
];

const COOKIE_MAX_AGE = 1000 * 60 * 60 * 24 * 7; // 7 days
const ROOM_NAME_MAX_LENGTH = 32;
const USERNAME_MAX_LENGTH = 32;
const WEBSOCKET_MAX_PAYLOAD = 1024 * 10 * 1; // 10 KB

const ADJECTIVES = ['adaptable', 'adept', 'affectionate', 'agreeable', 'alluring', 'amazing', 'ambitious', 'amiable', 'ample', 'approachable', 'awesome', 'blithesome', 'bountiful', 'brave', 'breathtaking', 'bright', 'brilliant', 'capable', 'captivating', 'charming', 'competitive', 'confident', 'considerate', 'courageous', 'creative', 'dazzling', 'determined', 'devoted', 'diligent', 'diplomatic', 'dynamic', 'educated', 'efficient', 'elegant', 'enchanting', 'energetic', 'engaging', 'excellent', 'fabulous', 'faithful', 'fantastic', 'favorable', 'fearless', 'flexible', 'focused', 'fortuitous', 'frank', 'friendly', 'funny', 'generous', 'giving', 'gleaming', 'glimmering', 'glistening', 'glittering', 'glowing', 'gorgeous', 'gregarious', 'gripping', 'hardworking', 'helpful', 'hilarious', 'honest', 'humorous', 'imaginative', 'incredible', 'independent', 'inquisitive', 'insightful', 'kind', 'knowledgeable', 'likable', 'lovely', 'loving', 'loyal', 'lustrous', 'magnificent', 'marvelous', 'mirthful', 'moving', 'nice', 'optimistic', 'organized', 'outstanding', 'passionate', 'patient', 'perfect', 'persistent', 'personable', 'philosophical', 'plucky', 'polite', 'powerful', 'productive', 'proficient', 'propitious', 'qualified', 'ravishing', 'relaxed', 'remarkable', 'resourceful', 'responsible', 'romantic', 'rousing', 'sensible', 'shimmering', 'shining', 'sincere', 'sleek', 'sparkling', 'spectacular', 'spellbinding', 'splendid', 'stellar', 'stunning', 'stupendous', 'super', 'technological', 'thoughtful', 'twinkling', 'unique', 'upbeat', 'vibrant', 'vivacious', 'vivid', 'warmhearted', 'willing', 'wondrous', 'zestful'];
Expand All @@ -127,10 +84,7 @@ export {
ALTERNATE_SUBCATEGORY_TO_CATEGORY,
ALTERNATE_SUBCATEGORIES_FLATTENED,
SUBCATEGORIES_FLATTENED,
PERMANENT_ROOMS,
COOKIE_MAX_AGE,
ROOM_NAME_MAX_LENGTH,
USERNAME_MAX_LENGTH,
WEBSOCKET_MAX_PAYLOAD,
ADJECTIVES,
ANIMALS,
Expand Down
2 changes: 1 addition & 1 deletion server/multiplayer/Player.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { USERNAME_MAX_LENGTH } from '../../constants.js';
import { USERNAME_MAX_LENGTH } from './constants.js';

class Player {
constructor(userId) {
Expand Down
4 changes: 3 additions & 1 deletion server/multiplayer/TossupRoom.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import Player from './Player.js';
import { PERMANENT_ROOMS, ROOM_NAME_MAX_LENGTH } from './constants.js';

import RateLimit from '../RateLimit.js';

import { HEADER, ENDC, OKBLUE, OKGREEN } from '../../bcolors.js';
import { DEFAULT_MIN_YEAR, DEFAULT_MAX_YEAR, PERMANENT_ROOMS, ROOM_NAME_MAX_LENGTH, CATEGORIES, SUBCATEGORIES_FLATTENED, ALTERNATE_SUBCATEGORIES_FLATTENED, SUBCATEGORY_TO_CATEGORY, ALTERNATE_SUBCATEGORY_TO_CATEGORY } from '../../constants.js';
import { DEFAULT_MIN_YEAR, DEFAULT_MAX_YEAR, CATEGORIES, SUBCATEGORIES_FLATTENED, ALTERNATE_SUBCATEGORIES_FLATTENED, SUBCATEGORY_TO_CATEGORY, ALTERNATE_SUBCATEGORY_TO_CATEGORY } from '../../constants.js';
import getRandomTossups from '../../database/qbreader/get-random-tossups.js';
import getSet from '../../database/qbreader/get-set.js';
import getSetList from '../../database/qbreader/get-set-list.js';
Expand Down
45 changes: 45 additions & 0 deletions server/multiplayer/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { CATEGORIES, SUBCATEGORIES_FLATTENED } from '../../constants.js';

export const ROOM_NAME_MAX_LENGTH = 32;
export const USERNAME_MAX_LENGTH = 32;

/**
* List of multiplayer permanent room names.
*/
export const PERMANENT_ROOMS = [
{
name: 'hsquizbowl',
categories: CATEGORIES,
subcategories: SUBCATEGORIES_FLATTENED,
},
{
name: 'collegequizbowl',
categories: CATEGORIES,
subcategories: SUBCATEGORIES_FLATTENED,
},
{
name: 'literature',
categories: ['Literature'],
subcategories: ['American Literature', 'British Literature', 'Classical Literature', 'European Literature', 'World Literature', 'Other Literature'],
},
{
name: 'history',
categories: ['History'],
subcategories: ['American History', 'Ancient History', 'European History', 'World History', 'Other History'],
},
{
name: 'science',
categories: ['Science'],
subcategories: ['Biology', 'Chemistry', 'Physics', 'Other Science'],
},
{
name: 'fine-arts',
categories: ['Fine Arts'],
subcategories: ['Visual Fine Arts', 'Auditory Fine Arts', 'Other Fine Arts'],
},
{
name: 'trash',
categories: ['Trash'],
subcategories: ['Trash'],
},
];

0 comments on commit 6a1c93e

Please sign in to comment.