public static int protocol_version(GTPBasics.SendAndRecieve sndRec) { string response = sndRec("protocol_version"); return Convert.ToInt32(response); }
//Same as gen_move, but does not play the move public static Ent_vertex reg_genmove(string color, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_color(color)); string response = sndRec("genmove " + string.Join(" ", entities)); if (response.ToLower() == "resign") return null; else return new Ent_vertex(response); }
public static List<Ent_vertex> place_free_handicap(int number_of_stones, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_int(number_of_stones)); //Super OO just because might as well string response = sndRec("place_free_handicap " + string.Join(" ", entities)); string[] delimitter = { " " }; string[] parts = response.Split(delimitter, StringSplitOptions.RemoveEmptyEntries); List<Ent_vertex> vertices = new List<Ent_vertex>(); for (int x = 0; x < parts.Length; x++) vertices.Add(new Ent_vertex(parts[x])); return vertices; }
//Unhandled error: "unacceptable size"! //coordinates are 0 based from bottom left of board public static void play(string color, int xPos, int yPos, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_move(new Ent_color(color), new Ent_vertex(xPos, yPos))); sndRec("play " + string.Join(" ", entities)); }
//Unhandled error message: "cannot undo"! public static void undo(GTPBasics.SendAndRecieve sndRec) { sndRec("undo"); }
public static string SendAndReceiveReponse(string command_name, List<Entity> entities, GTPBasics.SendAndRecieve sndRec) { foreach (Entity entity in entities) command_name += " " + entity.ToString(); return sndRec(command_name); }
public static void komi(float new_komi, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_float(new_komi)); //Super OO just because might as well sndRec("komi " + string.Join(" ", entities)); }
public static void time_left( string color, int time, int stones, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_color(color)); entities.Add(new Ent_int(time)); entities.Add(new Ent_int(stones)); sndRec("time_left " + string.Join(" ", entities)); }
public static List<Ent_vertex> final_status_list(string status, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_string(status)); //Super OO just because might as well string response = sndRec("final_score " + string.Join(" ", entities)); string[] delimitter = { " " }; string[] parts = response.Split(delimitter, StringSplitOptions.RemoveEmptyEntries); List<Ent_vertex> vertices = new List<Ent_vertex>(); for (int x = 0; x < parts.Length; x++) vertices.Add(new Ent_vertex(parts[x])); return vertices; }
public static bool known_command(string command_name, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_string(command_name)); //Super OO just because might as well return (new Ent_boolean(sndRec("known_command " + string.Join(" ", entities)))).data; }
//Unhandled error message: "cannot score"! public static string final_score(GTPBasics.SendAndRecieve sndRec) { return sndRec("final_score"); }
public static void clear_board(GTPBasics.SendAndRecieve sndRec) { sndRec("clear_board"); }
//Unhandled error: "unacceptable size"! public static void boardsize(int size, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_int(size)); //Super OO just because might as well sndRec("boardsize " + string.Join(" ", entities)); }
public static void set_free_handicap(List<Ent_vertex> vertices, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(vertices); sndRec("set_free_handicap " + string.Join(" ", entities)); }
public static string[] list_commands(GTPBasics.SendAndRecieve sndRec) { string response = sndRec("list_commands"); char[] delimitters = { GTPBasics.LF, GTPBasics.HT, GTPBasics.SPACE }; //I am not entirely sure, but I think just tabs (HT) will be enough return response.Split(delimitters, StringSplitOptions.RemoveEmptyEntries); }
public static string showboard(GTPBasics.SendAndRecieve sndRec) { return sndRec("showboard"); }
public static void loadsgf(string filename, int move_number, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_string(filename)); entities.Add(new Ent_int(move_number)); sndRec("loadsgf " + string.Join(" ", entities)); }
//Unhandled syntax errors! public static void time_settings( int main_time, int byo_yomi_time, int byo_yomi_stones, GTPBasics.SendAndRecieve sndRec) { List<Entity> entities = new List<Entity>(); entities.Add(new Ent_int(main_time)); entities.Add(new Ent_int(byo_yomi_time)); entities.Add(new Ent_int(byo_yomi_stones)); sndRec("time_settings " + string.Join(" ", entities)); }
public static string name(GTPBasics.SendAndRecieve sndRec) { return sndRec("name"); }
public static string version(GTPBasics.SendAndRecieve sndRec) { return sndRec("version"); }
public static string SendAndReceiveReponse(string command_name, GTPBasics.SendAndRecieve sndRec) { return SendAndReceiveReponse(command_name, new List<Entity>(), sndRec); }