To run the example project, clone the repo, and run pod install
from the Example directory first.
IkatagoSDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
platform :ios, '8.0'
target 'your_target_name' do
pod "IKatagoSDK", :git => "https://github.com/kinfkong/ikatago-ios-sdk.git"
end
View the example for detail, in the Example/IkatagoSDK/IKATAGOAppDelegate.m
#import <ikatagosdk/ikatagosdk.h>
IkatagosdkClient* client = [[IkatagosdkClient alloc] init:@"" platform:@"aistudio" username:@"kinfkong" password:@"12345678"];
// query the server to see what weights, configs this server supports
NSString* serverInfo = [client queryServer:&error];
if (error != nil) {
NSLog(@"error happens: %@", [error description]);
return;
}
// parse the server info to object from json string
NSLog(@"server info: %@", serverInfo);
Example 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 **
katago = [client createKatagoRunner:&error];
if (error != nil) {
NSLog(@"error happens: %@", [error description]);
return;
}
// set the 20b weight
[katago setKataWeight:@"20b"];
[katago run:callback error:&error];
if (error != nil) {
NSLog(@"error happens: %@", [error description]);
return;
}
[katago sendGTPCommand:@"version\n" error:&error];
if (error != nil) {
NSLog(@"error happens: %@", [error description]);
}
[katago sendGTPCommand:@"kata-analyze B 50\n" error:&error];
if (error != nil) {
NSLog(@"error happens: %@", [error description]);
}
@interface IKATAGODataCallback : NSObject <IkatagosdkDataCallback>
@end
@implementation IKATAGODataCallback
- (void)callback:(NSData* )content {
// simply output the data
NSString* contentString = [[NSString alloc] initWithData:content encoding:NSASCIIStringEncoding];
NSLog(@"%@", contentString);
}
- (void) stderrCallback:(NSData *)content {
// simply output the data
NSString* contentString = [[NSString alloc] initWithData:content encoding:NSASCIIStringEncoding];
NSLog(@"stderr: %@", contentString);
}
@end
@end
kinfkong, [email protected]
QQ Group: 703409387
IkatagoSDK is available under the MIT license. See the LICENSE file for more info.