mirror of
https://github.com/Balshgit/public.git
synced 2025-09-11 18:00:42 +03:00
blocks searcher added
This commit is contained in:
parent
41106f87b3
commit
fb741f4685
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.idea
|
||||
blocks_test.py
|
||||
Anna_blocks.py
|
19
blocks.py
19
blocks.py
@ -1,8 +1,9 @@
|
||||
import copy
|
||||
from random import randint
|
||||
from typing import Union
|
||||
|
||||
LIST_HEIGHT = 8
|
||||
LIST_WIDTH = 7
|
||||
LIST_HEIGHT = 9
|
||||
LIST_WIDTH = 6
|
||||
|
||||
|
||||
# List generator for check
|
||||
@ -13,8 +14,8 @@ def list_generator() -> None:
|
||||
print(f'{test_list[row]},')
|
||||
print(']')
|
||||
|
||||
# list_generator()
|
||||
|
||||
# list_generator()
|
||||
|
||||
arr = [
|
||||
# 0 1 2 3 4 5 6
|
||||
@ -75,7 +76,7 @@ class BlockSearcher:
|
||||
self.changer(self.array_copy, element, temp_element)
|
||||
|
||||
# change doubled values
|
||||
def changer(self, array: list, element: str, insert: str) -> list:
|
||||
def changer(self, array: list, element: Union[str, int], insert: str) -> list:
|
||||
for row in range(self.height):
|
||||
for column in range(self.width):
|
||||
if array[row][column] == element:
|
||||
@ -104,10 +105,14 @@ class BlockSearcher:
|
||||
# print both arrays for debug
|
||||
def print(self) -> None:
|
||||
for row in range(self.height):
|
||||
print(self.array[row], self.array_copy[row])
|
||||
print(self.array[row], ' <|> ', self.array_copy[row])
|
||||
|
||||
|
||||
bs = BlockSearcher(arr)
|
||||
bs.analyze()
|
||||
# bs.print() # use for DEBUG
|
||||
print(f'Total blocks: {bs.blocks_count()}')
|
||||
blocks_count = bs.blocks_count()
|
||||
print(f'Total blocks: {blocks_count}')
|
||||
|
||||
# ------ use for DEBUG -------
|
||||
bs.changer(bs.array_copy, 0, '00')
|
||||
bs.print()
|
||||
|
Loading…
x
Reference in New Issue
Block a user