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.
 
 
 

28 lines
687 B

const uuid = require('node-uuid');
const Game = function() {
this.id = uuid.v4();
const walls = [
{x: 8, y: 9, n: 1, e: 0, s: 0, w: 1 },
{x: 18, y: 9, n: 1, e: 0, s: 0, w: 1 },
{x: 4, y: 19, n: 1, e: 0, s: 0, w: 1 }
];
const buffers = walls.map(w => {
const buffer = new ArrayBuffer(6);
const view = new DataView(buffer)
view.setInt8(0, w.x);
view.setInt8(1, w.y);
view.setInt8(2, w.n);
view.setInt8(3, w.s);
view.setInt8(4, w.e);
view.setInt8(5, w.w);
return Array.prototype.slice.call(new Int8Array(buffer));
});
this.walls = buffers;
}
module.exports = Game;