-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
53 lines (44 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import start from './modules/start.js';
import { shuffle } from './modules/utils.js';
export const points = {
settlementVertices: [],
cityVertices: [],
roadEdges: []
}
export const buildings = {
settlements: [],
cities: [],
roads: []
}
const colors = shuffle(["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF", "#FF8000", "#FFFFFF"]);
export const game = {
players: new Set(),
clients: new Set(),
ready: new Set(),
turn: 0,
round: 0,
longestRoad: {
length: 0,
player: null
},
map: null,
developments: [],
colors: Array.from(colors),
availableColors: Array.from(colors),
gameover: false
}
export const mapLengths = [3, 4, 5, 4, 3];
export const terrainToResource = {
'Forest': 'lumber',
'Hill': 'brick',
'Mountain': 'ore',
'Pasture': 'wool',
'Field': 'grain'
}
export function getPlayerArray() {
return Array.from(game.players);
}
export function getTurnPlayer() {
return getPlayerArray()[game.turn % game.players.size];
}
start();