Accessing the API should be very simple.
There are only two REST calls, one creates a new game to obtain a game id and a player id.
The other method to make moves.
If you are unfamiliar with REST you should take a look at the code below.
You can also access API documentation at this site.
using System; using System.Net.Http; using System.Net.Http.Headers; using System.Threading.Tasks; using Newtonsoft.Json; using BotAi; public class Example { private HttpClient HttpClient { get; set; } public void Init() { HttpClient = new HttpClient { BaseAddress = new Uri("http://airobotsrestservice.azurewebsites.net") }; HttpClient.DefaultRequestHeaders.Accept.Clear(); HttpClient.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); } public void FindExit() { var userId = "c9356e13-d74b-4756-8c23-90c5bee67b53"; //Please use your own user id. ;) var ng = Get<NewGame>($"/api/User/{userId}/NewGame"); var gameId = ng.GameId; var playerId = ng.PlayerId; var ai = new AI(); ai.Input(ng.BotView); while (!ai.ExitFound) { var direction = ai.GetBestDirection(); var nextView = Get<string>($"/api/Player/{playerId}/Game/{gameId}/Move/{direction}"); if (!ai.ExitFound) ai.Input(nextView); } } T Get<T>(string path) { var responseTask = HttpClient.GetAsync(path); responseTask.Wait(); var response = responseTask.Result; var task = response.Content.ReadAsStringAsync(); task.Wait(); if (response.IsSuccessStatusCode) return JsonConvert.DeserializeObject<T>(task.Result); throw new ApplicationException($"Unseccessfull response {response.StatusCode}.{task.Result}); } class NewGame { public Guid GameId { get; set; } public string BotView { get; set; } public int PlayerId { get; set; } } }
Ny text!