From bfd3e10c228ef150758b5fab2a51f5c2f29ddfe0 Mon Sep 17 00:00:00 2001 From: Kento HASEGAWA Date: Thu, 18 Jul 2019 02:35:49 +0900 Subject: [PATCH] Add support for a real solver in /solvers/ --- .gitignore | 2 +- roles/host.py | 1 + solvers/hsgw | 2 +- utils/data.py | 4 ++++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bf7dd28..f3b14b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ ### https://raw.github.com/github/gitignore/9d7ff09c7d38dce9ef03e7ea4dc908a622546757/Python.gitignore # Project-specific files -/conf.json +/conf*.json /problems/* !/problems/.gitkeep /solutions/* diff --git a/roles/host.py b/roles/host.py index 6f4b9a1..05d928b 100644 --- a/roles/host.py +++ b/roles/host.py @@ -84,6 +84,7 @@ class Host(object): if problem_key in self.problems: self.problems[problem_key].put_solution(solution) + print(solution['solution']) return {'status': 'registered'} else: return {'status': 'error'} diff --git a/solvers/hsgw b/solvers/hsgw index b306364..0098cc9 160000 --- a/solvers/hsgw +++ b/solvers/hsgw @@ -1 +1 @@ -Subproject commit b306364dc696270165a9c67921720e4c6acf6866 +Subproject commit 0098cc9c1932bd192f6a5fe066d9aea7960e5400 diff --git a/utils/data.py b/utils/data.py index 811fad1..a371b6d 100644 --- a/utils/data.py +++ b/utils/data.py @@ -11,6 +11,7 @@ class Problem(object): self.name = '' self.size = (0, 0) self.block_num = 0 + self.problem = '' self.status = 'Ready' self.solutions = dict() @@ -23,6 +24,7 @@ class Problem(object): def _load_problem(self, path): with open(path, 'r') as fp: + q_text = fp.read() q_lines = fp.readlines() board_size = [0, 0] @@ -40,6 +42,7 @@ class Problem(object): self.size = board_size self.block_num = block_num self.name = name + self.problem = q_text self.status = 'Ready' def get_dict(self): @@ -48,6 +51,7 @@ class Problem(object): 'size': self.size, 'size_str': self.size_str, 'block_num': self.block_num, + 'problem': self.problem, 'status': self.status } -- 2.22.0