From 202b162b63c58c7cf956fa2c51d97b39d8dac9c1 Mon Sep 17 00:00:00 2001 From: DUEFON Date: Tue, 13 Dec 2022 00:54:53 +0100 Subject: [PATCH] 12a --- test12 | 5 +++++ twelve.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 test12 diff --git a/test12 b/test12 new file mode 100644 index 0000000..86e9cac --- /dev/null +++ b/test12 @@ -0,0 +1,5 @@ +Sabqponm +abcryxxl +accszExk +acctuvwj +abdefghi diff --git a/twelve.py b/twelve.py index 4aaaef6..ff35b26 100755 --- a/twelve.py +++ b/twelve.py @@ -21,7 +21,7 @@ s = np.empty((h, w)) s.fill(h*w) # enough tovisit = deque([S]) def visits(y, x): - return [(y+u-1, x+v-1) for u in range(3) for v in range(3) + return [(y+u-1, x+v-1) for (u, v) in [(2, 1), (0, 1), (1, 2), (1, 0)] if y+u-1 >= 0 and y+u-1 < h and x+v-1 >= 0 and x+v-1 < w and goto[u][v][y,x]] #ic(a)