Skip to content

Commit d3b8d64

Browse files
Update word_search.py
1 parent 767aa40 commit d3b8d64

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

other/word_search.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ def insert_north(self, word: str, rows: list[int], cols: list[int]) -> None:
6969
def insert_northeast(self, word: str, rows: list[int], cols: list[int]) -> None:
7070
"""
7171
>>> ws = WordSearch(WORDS, 3, 3)
72-
>>> ws.insert_north_east("cat", [2], [0])
72+
>>> ws.insert_northeast("cat", [2], [0])
7373
>>> ws.board # doctest: +NORMALIZE_WHITESPACE
7474
[[None, None, 't'],
7575
[None, 'a', None],
7676
['c', None, None]]
77-
>>> ws.insert_north_east("at", [0, 1], [2, 1, 0])
77+
>>> ws.insert_northeast("at", [0, 1], [2, 1, 0])
7878
>>> ws.board # doctest: +NORMALIZE_WHITESPACE
7979
[[None, 't', 't'],
8080
['a', 'a', None],
@@ -139,12 +139,12 @@ def insert_east(self, word: str, rows: list[int], cols: list[int]) -> None:
139139
def insert_southeast(self, word: str, rows: list[int], cols: list[int]) -> None:
140140
"""
141141
>>> ws = WordSearch(WORDS, 3, 3)
142-
>>> ws.insert_south_east("cat", [0], [0])
142+
>>> ws.insert_southeast("cat", [0], [0])
143143
>>> ws.board # doctest: +NORMALIZE_WHITESPACE
144144
[['c', None, None],
145145
[None, 'a', None],
146146
[None, None, 't']]
147-
>>> ws.insert_south_east("at", [1, 0], [2, 1, 0])
147+
>>> ws.insert_southeast("at", [1, 0], [2, 1, 0])
148148
>>> ws.board # doctest: +NORMALIZE_WHITESPACE
149149
[['c', None, None],
150150
['a', 'a', None],
@@ -209,12 +209,12 @@ def insert_south(self, word: str, rows: list[int], cols: list[int]) -> None:
209209
def insert_southwest(self, word: str, rows: list[int], cols: list[int]) -> None:
210210
"""
211211
>>> ws = WordSearch(WORDS, 3, 3)
212-
>>> ws.insert_south_west("cat", [0], [2])
212+
>>> ws.insert_southwest("cat", [0], [2])
213213
>>> ws.board # doctest: +NORMALIZE_WHITESPACE
214214
[[None, None, 'c'],
215215
[None, 'a', None],
216216
['t', None, None]]
217-
>>> ws.insert_south_west("at", [1, 2], [2, 1, 0])
217+
>>> ws.insert_southwest("at", [1, 2], [2, 1, 0])
218218
>>> ws.board # doctest: +NORMALIZE_WHITESPACE
219219
[[None, None, 'c'],
220220
[None, 'a', 'a'],
@@ -279,12 +279,12 @@ def insert_west(self, word: str, rows: list[int], cols: list[int]) -> None:
279279
def insert_northwest(self, word: str, rows: list[int], cols: list[int]) -> None:
280280
"""
281281
>>> ws = WordSearch(WORDS, 3, 3)
282-
>>> ws.insert_north_west("cat", [2], [2])
282+
>>> ws.insert_northwest("cat", [2], [2])
283283
>>> ws.board # doctest: +NORMALIZE_WHITESPACE
284284
[['t', None, None],
285285
[None, 'a', None],
286286
[None, None, 'c']]
287-
>>> ws.insert_north_west("at", [1, 2], [0, 1])
287+
>>> ws.insert_northwest("at", [1, 2], [0, 1])
288288
>>> ws.board # doctest: +NORMALIZE_WHITESPACE
289289
[['t', None, None],
290290
['t', 'a', None],
@@ -326,12 +326,13 @@ def generate_board(self) -> None:
326326
"""
327327
directions = (
328328
self.insert_north,
329-
self.insert_north_east,
329+
self.insert_northeast,
330330
self.insert_east,
331-
self.insert_south_east,
331+
self.insert_southeast,
332332
self.insert_south,
333-
self.insert_south_west,
333+
self.insert_southwest,
334334
self.insert_west,
335+
self.insert_northwest,
335336
)
336337
for word in self.words:
337338
# Shuffle the row order and column order that is used when brute forcing
@@ -359,7 +360,7 @@ def visualise_word_search(
359360
# # # # t
360361
# # # # a
361362
# # # # c
362-
>>> ws.insert_north_east("snake", [4], [4, 3, 2, 1, 0])
363+
>>> ws.insert_northeast("snake", [4], [4, 3, 2, 1, 0])
363364
>>> visualise_word_search(
364365
... ws.board, add_fake_chars=False) # doctest: +NORMALIZE_WHITESPACE
365366
# # # # e

0 commit comments

Comments
 (0)