Example for using this ikatagosdk is in Example folder. Sample codes are in MainActivity.java classes.
Import the ikatagosdk.aar in this folder to your project. See how:
http://docs.onemobilesdk.aol.com/android-ad-sdk/adding-aar-files.html
View the example for detail, in the Example/app/src/main/java/com/ikatago/kinfkong/ikatagosdkdemo/MainActivity.java
import ikatagosdk.Client;
import ikatagosdk.DataCallback;
import ikatagosdk.KatagoRunner;
final Client client = new Client("", "aistudio", "kinfkong", "12345678");
// query the server info
String serverInfo = client.queryServer();
// you can parse the json string to objectExample of the json response of the server info:
{"serverVersion":"1.4.0","supportKataWeights":[{"name":"20b","description":null},{"name":"30b","description":null},{"name":"40b","description":null},{"name":"40b-large","description":null}],"supportKataNames":[{"name":"katago-1.5.0","description":null},{"name":"katago-1.6.0","description":null},{"name":"katago-1.3.4","description":null},{"name":"katago-solve","description":null}],"supportKataConfigs":[{"name":"default_gtp","description":null},{"name":"10spermove","description":null},{"name":"2stones_handicap","description":null},{"name":"3stones_handicap","description":null},{"name":"4stones_handicap","description":null},{"name":"5stones_handicap","description":null},{"name":"6stones_handicap","description":null},{"name":"7+stones_handicap","description":null}],"defaultKataName":"katago-1.6.0","defaultKataWeight":"40b","defaultKataConfig":"default_gtp"}** Note: queryServer api only supports the ikatago-server since 1.4.0 **
// create the katago runner
KatagoRunner katago = client.createKatagoRunner();
// set the katago weight or others
katago.setKataWeight("20b");
// start to run the katago
katago.run(callback); // send GTP command
katago.sendGTPCommand("version\n");
katago.sendGTPCommand("kata-analyze B 50\n");class DataCallbackImpl implements DataCallback {
@Override
public void callback(byte[] bytes) {
// simply write the data to log
Log.d("GTP OUTPUT: ", new String(bytes));
}
}kinfkong, kinfkong@126.com
QQ Group: 703409387
IkatagoSDK is available under the MIT license. See the LICENSE file for more info.