Working on 2023-12-13 p1

This commit is contained in:
Frederik Baerentsen 2023-12-15 14:11:48 -05:00
parent 8bc7688e6c
commit 57c165da42

View File

@ -5,6 +5,8 @@ import time
import math
import numpy as np
#21275 too low
#colors
from termcolor import colored
@ -50,15 +52,17 @@ def find_sym_col(grid):
#print('Testing columns' + str(c))
mirror_count = 0
for i in range(len(grid)):
#print(grid[i][c],grid[i][c+1])
#print(grid[i][c],grid[i][c+1],end='')
if grid[i][c] == grid[i][c+1]:
mirror_count += 1
else:
break
#print('match')
#else:
#print('not match')
# break
if mirror_count == len(grid):
found = True
#print('mirror at ' + str(c))
print('mirror at ' + str(c))
for x in range(c,-1,-1):
if (c-x)+c+1 < len(col):
#print(x,(c-x)+c+1)
@ -67,9 +71,13 @@ def find_sym_col(grid):
if grid[y][x] == grid[y][(c-x)+c+1]:
#print(grid[y][x],grid[y][(c-x)+c+1])
mirror = c+1
found = True
else:
found = False
if found:
return mirror
else:
return None
return mirror
def find_sym_row(grid):
@ -85,8 +93,12 @@ def find_sym_row(grid):
found = True
mirror = r+1
else:
found = False
return None
if found:
return mirror
else:
return None
tmp = []
@ -105,7 +117,8 @@ for i in grid:
if i == []:
t = find_sym(tmp)
print(t)
input()
#input()
if t[0] != None:
if t[1] == 'c':
result += t[0]
if t[1] == 'r':