import java io import java net import java util import java lang Strin

  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
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
import java.io.*;
import java.net.*;
import java.util.*;
import java.lang.String.*;
public class BotEnv {
private SocketMaster m_SM;
private AlgoBrain m_AB;
private Parser m_P;
public BotEnv() {
m_SM = new SocketMaster(this);
m_AB = new AlgoBrain(this);
m_P = new Parser(this);
}
public static void main(String[] _args) {
new BotEnv().m_SM.run();
}
public void ProccessComand(String cmd)
{
m_P.Parse(cmd);
/// запуск алгобрейна потом
}
}
class SocketMaster {
private BotEnv m_BE;
private Socket m_sock;
private Scanner m_in;
private PrintWriter m_out;
public SocketMaster(BotEnv _bptr) {
m_BE = _bptr;
try {
m_sock = new Socket(HOST, PORT);
m_in = new Scanner(m_sock.getInputStream());
m_out = new PrintWriter(m_sock.getOutputStream());
} catch (Exception _e) {
_e.printStackTrace();
}
}
public void run() {
m_out.println(INIT_STRING);
m_out.flush();
// Here we going to get all fucking shit, from task details to input stream...
String get, put, cmd="";
while (m_in.hasNext()) {
get = m_in.next();
// parsing is here...
// processing is here... (redirect to m_BE)
// output is here...
put = null;
//m_out.println(put);
if(get.indexOf("config>")!= -1)
{
get=get.substring(get.indexOf("config>")+7);
cmd="";
}
if(get.indexOf(';')!= -1)
{
cmd = cmd + get.substring(0, get.indexOf(';'));
m_BE.ProccessComand(cmd);
cmd=get.substring(get.indexOf(';')+1)+ " ";
}
else
{
cmd = cmd + get + " ";
}
}
}
final String INIT_STRING = "launch heratorz CFGSrUPQPKgtmDcKuOhgCSy#CFGwjQJiWQQUViJiymrQoGY#CFGUfimkSUQhcMgGMqlWQYs#CFGWYiZmCiYpYaYWZuBspkg#CFGAEeaubIIRkDOlIxGmyPM#CFGYLEQYicsFWmjwKmXaOmC#CFGufAMuyIOhKxKaSOxoxUN#CFGowmRWjWSWxcZiqlGeYkF#CFGUpogIViMtiOkulA@IYoZ#CFGQOwAkDwyVAZCoKTqFuyJ#CFGMSYfClQgVEaUuinytily#CFGyNQRgQmanQxKmUAXEepm;";
final String HOST = "localhost"; // will be 1st cmd par
final int PORT = 20016; // will be 2nd cmd par
}
class AlgoBrain {
private BotEnv m_BE;
public AlgoBrain(BotEnv _bptr) {
m_BE = _bptr;
}
}
class Parser {
private BotEnv m_BE;
public Parser(BotEnv _bptr)
{
m_BE = _bptr;
}
public void Parse(String cmd)
{
System.out.println(cmd);
}
private void TimerTick(String cmd)
{
}
private void StartComand(String cmd)
{
}
}