protected TetrisAlgorithmSetting <TWeights> CreateAlgorithm <TWeights>(ITetrisAlgorithmT <TWeights> algorithmT) { var result = this.httpClient.PostAsync("/evolutions", this.ConverToContent(algorithmT)).Result; return(JsonConvert.DeserializeObject <TetrisAlgorithmSetting <TWeights> >(result.Content.ReadAsStringAsync().Result)); }
public TetrisAlgorithmSetting <TWeights> GetAlgorithmSettings <TAlgorithm, TWeights>(ITetrisAlgorithmT <TWeights> algorithmT) where TWeights : class, new() { var tetrisAlgorithm = this.GetAlgorithm <TAlgorithm>(); if (tetrisAlgorithm == null) { return(this.CreateAlgorithm(new TetrisAlgorithmT <TWeights> { Name = typeof(TAlgorithm).Name, Weights = this.GetInstance <TWeights>() })); } var result = this.httpClient.GetStringAsync($"/evolutions/{tetrisAlgorithm.AlgorithmId}/settings").Result; return(JsonConvert.DeserializeObject <TetrisAlgorithmSetting <TWeights> >(result)); }