-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask_9.py
30 lines (26 loc) · 995 Bytes
/
task_9.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from collections import Counter
from arc_tools import grid
from arc_tools.grid import Grid, detect_objects, Color, SubGrid, GridRegion, GridPoint, move_object, Square
from arc_tools.plot import plot_grid, plot_grids
from arc_tools.logger import logger
plus_pos = (-1,1),(0,1),(1,1),(0,2)
def is_plus(x,y,grid):
for dx,dy in plus_pos:
if grid[y+dy][x+dx] != Color.YELLOW.value:
return False
return True
def highlight_plus(grid: Grid) -> Grid:
'''
replace yellow plus with light blue plus
'''
for y in range(grid.height):
for x in range(grid.width):
if grid[y][x] == Color.YELLOW.value:
if is_plus(x,y,grid):
grid[y][x] = Color.LIGHTBLUE.value
for dx,dy in plus_pos:
grid[y+dy][x+dx] = Color.LIGHTBLUE.value
return grid
if __name__ == "__main__":
import os
os.system("python main.py 1818057f highlight_plus")