Beispiel #1
0
 public IActionResult NextGeneration([FromBody] Models.NextDataRequest value)
 {
     return(new ObjectResult(new Models.NextDataRequest()
     {
         Data = new GOF.Game().GetNextGeneration(value.Data)
     }));
 }
Beispiel #2
0
        public static async Task <int[, ]> GetNextGeneration(int[,] data)
        {
            JObject content = JObject.FromObject(new Models.NextDataRequest()
            {
                Data = data
            });

            string response = await Commands.ExecutePostCommand(Constants.NextGeneration, content.ToString());

            try
            {
                Models.NextDataRequest responseData = JsonConvert.DeserializeObject <Models.NextDataRequest>(response, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
                return(responseData.Data);
            }
            catch (Exception)
            {
                return(null);
            }
        }