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.

game.js 466B

1234567891011121314151617181920212223242526272829
  1. module.exports = function(players) {
  2. this._players = players;
  3. var ps = players.map(function(p) {
  4. return {
  5. type: p.data.type,
  6. }
  7. });
  8. players.forEach(function(p, i) {
  9. p.data.index = i;
  10. p.data.req.reply({
  11. players: ps,
  12. index: i
  13. });
  14. p.on("close", function() {
  15. players.forEach(function(p, i) {
  16. p.send("gameover", {
  17. msg: "Opponent quit."
  18. });
  19. });
  20. });
  21. });
  22. }
  23. module.exports.prototype.message = function(args, req, sock) {
  24. }