// A bot which responds to `jarvis` with a box const space = require('../space'); const socket = require('../socket'); var main = new socket.Socket(); function equals(arg1,arg2){ // Just takes the specific case argument of each being an int pair return arg1[0] == arg2[0] && arg1[1] == arg2[1] } main.on('open', ()=>{ // Tries to identify itself with a cursor movement let coords = [Math.floor(Math.random()*100000+16),Math.floor(Math.random()*100000+16)]; main.cursor(coords); main.on('cursor', detect); function detect(pos, send){ if (equals(pos[0],coords)){ main.off('cursor', detect); this.emit('identity', sender); } } }) main.on('identity', (sender) => { }