From 65128ee7a55e0f0b5997bb2932582a0a1a0ae779 Mon Sep 17 00:00:00 2001 From: Morgana Date: Sat, 3 Oct 2026 16:37:05 -0500 Subject: Implement eGuide --- captcha.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'captcha.py') diff --git a/captcha.py b/captcha.py index e5fe28c..4011bbd 100644 --- a/captcha.py +++ b/captcha.py @@ -24,6 +24,22 @@ def adj(grid, x: int, y: int, orth=False, center=False) -> list[int]: return [v for v in base if v is not None] +def across(grid, x: int, y: int) -> bool: + side_length = int(len(grid) ** 0.5) + cell = value(grid, x, y) + for nx in range(0, side_length): + if value(grid, nx, y) != cell: + break + else: + return True + for ny in range(0, side_length): + if value(grid, x, ny) != cell: + break + else: + return True + return False + + class Shape: def __init__(self, grid, x: int, y: int) -> None: self.value = value(grid, x, y) @@ -130,6 +146,9 @@ class Captcha: near = adj(answer, x, y, True, False) if len(near) != len(set(near)): return False + case "l": + if not across(answer, x, y): + return False case "m": shape = Shape(answer, x, y) if shape_match_m: -- cgit v1.3.1