Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodejsClient.js
More file actions
Latest commit
39 lines (35 loc) · 992 Bytes
/
Copy pathnodejsClient.js
File metadata and controls
39 lines (35 loc) · 992 Bytes
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
// print process.argv
varnet=require('net');
varplayerNode=require('./playernode.js');
varbot=playerNode.newPlayer();
varclient=net.connect(5000,"localhost",function(){
console.log('bot connected');
varuser="kuryaki";//escribe tu nombre de usuario aca
vartoken="4fe8eb278a1094896a000003";//escribe tu token de autenticacion de bomberbot.com
client.write(process.argv[2]+","+process.argv[3]+"\r\n");
});
client.on('data',function(data){
varinfo=data.toString().split(";");
switch(info[0]){
case"EMPEZO":
//leemos el mapa incial y nuestra letra
bot.letter=info[2];
bot.updateMap(info[1]);
break;
case"TURNO":
console.log(info[1]);
bot.updateMap(info[2]);
varmov=bot.move();
client.write(mov);
break;
case"PERDIO":
console.log("perdi :'( ");
break;
default:
console.log(info[0]);
break;
}
});
client.on('end',function(){
console.log('bot disconnected');
});