-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
homework02 К24 Юров Кирилл 1.3 #272
Conversation
Если к 28 января сделаете хорошее ревью работы в этом пул-реквесте (#269), вам хватит баллов, чтобы закрыться |
Ревью зачтено |
path = pathlib.Path(path) | ||
with path.open() as f: | ||
puzzle = f.read() | ||
return create_grid(puzzle) | ||
|
||
|
||
def create_grid(puzzle: str) -> tp.List[tp.List[str]]: | ||
"""Creates grid for puzzle""" | ||
digits = [c for c in puzzle if c in "123456789."] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно упростить и объединить две строки (20 и 21) в grid = [int(char) for char in puzzle if char in '123456789.']
for j in range(0, 9, 3): | ||
arr = get_block(solution, (i, j)) | ||
used = [0] * 10 | ||
for z, val in enumerate(arr): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Немного усложнил перебор массива с лишним enumerate, тк z не использовалась
ch_pos = dot_list[replace_pos] | ||
empty_grid[ch_pos[0]][ch_pos[1]] = cor_grid[ch_pos[0]][ch_pos[1]] | ||
dot_list.pop(replace_pos) | ||
return empty_grid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мне кажется, что данный код не генерирует случайный массив, а только выбирает случайные точки из этого массива и, допустим, на n>=81 ответ будет один и тот же и массив не будет отличаться
No description provided.