2018-08-11 06:26:25 +00:00
|
|
|
import 藍 from './ai';
|
2018-08-11 01:42:06 +00:00
|
|
|
import config from './config';
|
|
|
|
import ReversiModule from './modules/reversi';
|
2018-08-11 03:19:34 +00:00
|
|
|
import ServerModule from './modules/server';
|
2018-08-11 06:26:25 +00:00
|
|
|
import PingModule from './modules/ping';
|
|
|
|
import * as request from 'request-promise-native';
|
|
|
|
const promiseRetry = require('promise-retry');
|
2018-08-11 03:34:24 +00:00
|
|
|
|
2018-08-11 06:26:25 +00:00
|
|
|
promiseRetry(retry => {
|
|
|
|
return request.post(`${config.apiUrl}/i`, {
|
|
|
|
json: {
|
|
|
|
i: config.i
|
2018-08-10 17:28:31 +00:00
|
|
|
}
|
2018-08-11 06:26:25 +00:00
|
|
|
}).catch(retry);
|
|
|
|
}).then(account => {
|
|
|
|
const ai = new 藍(account);
|
|
|
|
|
|
|
|
ai.install(new PingModule());
|
|
|
|
ai.install(new ServerModule());
|
|
|
|
ai.install(new ReversiModule());
|
|
|
|
});
|