You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 lines
759 B

const uuid = require('node-uuid');
const players = {};
const Game = function() {
this.id = uuid.v4();
}
Game.prototype.addPlayer = function(id, name) {
if (!players[id]) {
players[id] = name;
}
}
Game.prototype.removePlayer = function(id) {
players[id] = undefined;
delete players[id];
}
Game.prototype.getPlayers = function() {
return players;
}
Game.prototype.getRobots = function() {
return [
{i: 4, j: 3, color: '#E00000' },
{i: 1, j: 3, color: '#00C000' },
{i: 1, j: 19, color: '#0000C0' }
];
}
Game.prototype.getWalls = function() {
// Edge IDs are of the form [i1-j1-i2-j2]. Top left is 0, 0.
return [
"4-8-5-8",
"8-3-8-4"
];
};
module.exports = Game;