public string Solve(ProblemDefinitionDto problemDefinition)
        {
            Map map = new Map(problemDefinition.Map);

            Cell C(Point2dDto p) => map[p.X, p.Y];

            var    start    = C(problemDefinition.Astroants);
            var    end      = C(problemDefinition.Sugar);
            string solution = Solve(map, start, end);

            return(solution);
        }
Beispiel #2
0
        public async Task <ProblemSolutionResponseDto> PutSolution(ProblemDefinitionDto definition, ProblemSolutionDto solution)
        {
            var response = await httpClient.PutAsync(Endpoints.GetTaskSubmitUrl(definition.Id), PrepareJsonContent(solution));

            var content = await response.Content.ReadAsStringAsync();

            var result = jsonConvert.Deserialize <ProblemSolutionResponseDto>(content);

            if (saveRequests)
            {
                await File.WriteAllTextAsync($"{SaveDirectory}/solution-{definition.Id}.json", solution.Path);
            }
            return(result);
        }
 public void OneTimeSetUp()
 {
     problemSolver     = new ProblemSolver();
     problemDefinition = new ProblemDefinitionDto
     {
         Map = new MapDto
         {
             Areas = new[] { "5-R", "1-RDL", "10-DL", "2-RD", "1-UL", "1-UD", "2-RU", "1-RL", "2-UL" }
         },
         Astroants = new Point2dDto
         {
             X = 1,
             Y = 0,
         },
         Sugar = new Point2dDto
         {
             X = 2,
             Y = 1,
         }
     };
 }