回答編集履歴
3
fixed code
test
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
`range()`の`rows`と`cols`が逆,もしくは`mask[x,
|
1
|
+
`range()`の`rows`と`cols`が逆,もしくは`mask[x,y]`の`x,y`を逆にすると直ります.
|
2
2
|
|
3
3
|
コードの意味的には,`range()`の`rows`と`cols`を逆にするのが正しそうです.
|
4
4
|
```Python
|
5
5
|
for x in range(rows):
|
6
6
|
for y in range(cols):
|
7
|
-
maskc[x, y] =
|
7
|
+
maskc[x, y] = abs(x - crow) < mask and abs(y - ccol) < mask
|
8
8
|
```
|
2
append code example
test
CHANGED
@@ -1,3 +1,8 @@
|
|
1
1
|
`range()`の`rows`と`cols`が逆,もしくは`mask[x, y]`の`x,y`を逆にすると直ります.
|
2
2
|
|
3
3
|
コードの意味的には,`range()`の`rows`と`cols`を逆にするのが正しそうです.
|
4
|
+
```Python
|
5
|
+
for x in range(rows):
|
6
|
+
for y in range(cols):
|
7
|
+
maskc[x, y] = int(abs(x - crow) < mask and abs(y - ccol) < mask)
|
8
|
+
```
|
1
fix context
test
CHANGED
@@ -1,5 +1,3 @@
|
|
1
1
|
`range()`の`rows`と`cols`が逆,もしくは`mask[x, y]`の`x,y`を逆にすると直ります.
|
2
2
|
|
3
|
-
コードの意味的には,`
|
3
|
+
コードの意味的には,`range()`の`rows`と`cols`を逆にするのが正しそうです.
|
4
|
-
|
5
|
-
直感的に`x, y`の順になるのはわかりますが,よく考えると`y, x`の順であることがわかるはずです.
|