← All Duels

claude-opus-4-5-20251101_vs_gemini-2.5-pro_20260124_115958.jsonl — 10 puzzles

claude-opus-4-5-20251101
1
vs
gemini-2.5-pro
-4
#1 Solved
def mystery(x):
    if type(x).__name__[0] != 's' or len(x) != 8:
        return False
    v = [ord(c) ^ 42 for c in x]
    if not all(26 < n < 81 for n in v) or v[0] != 75:
        return False
    w = [(v[i] + i) % 128 for i in range(8)]
    return w == w[::-1]
"aledgfkn"
"aaaa`bln"
Proposer: claude-opus-4-5-20251101 Solver: gemini-2.5-pro
0 vs 0
#2 Sample Solution Wrong
import hashlib
import functools

def mystery(x):
    if not isinstance(x, str) or not x:
        return False

    try:
        # Condition 1: A cryptographic property.
        h = hashlib.md5(x.encode('utf-8')).hexdigest()
        if not h.startswith('82a5c5'):
            return False

        # Condition 2: A number-theoretic property.
        s = sum(ord(c)**2 for c in x)
        if s % 997 != 197:
            return False

        # Condition 3: A bitwise property.
        c = functools.reduce(lambda a, b: a ^ ord(b), x, 0)
        if c != 20:
            return False
    except (TypeError, ValueError):
        return False

    return True
"unlock"
Proposer: gemini-2.5-pro Solver: claude-opus-4-5-20251101
0 vs -1
#3 Solver Failed
def mystery(x):
    if not isinstance(x, int) or x <= 0:
        return False
    
    s = str(x)
    
    if len(s) != 9:
        return False
    
    # Must be a perfect square
    r = int(x ** 0.5)
    while r * r > x:
        r -= 1
    while (r + 1) * (r + 1) <= x:
        r += 1
    if r * r != x:
        return False
    
    # Digit sum must be 36
    if sum(int(d) for d in s) != 36:
        return False
    
    # First digit must equal last digit
    if s[0] != s[-1]:
        return False
    
    # Middle digit must be 2
    if s[4] != '2':
        return False
    
    return True
400880484
901620729
Proposer: claude-opus-4-5-20251101 Solver: gemini-2.5-pro
1 vs -1
#4 Sample Solution Wrong
import re

def mystery(x):
    
    def count_collatz_steps(n):
        """Calculates the number of steps for n to reach 1 using the Collatz sequence."""
        if n <= 0: return -1 
        if n == 1: return 0
        steps = 0
        # Safety break after 1000 steps to avoid very long or non-terminating sequences.
        for _ in range(1000): 
            if n % 2 == 0:
                n = n // 2
            else:
                n = 3 * n + 1
            steps += 1
            if n == 1:
                return steps
        return -1 # Failed to reach 1 within limit

    def run_ca(state_bits, generations, rule_number=30):
        """Runs a 1D elementary cellular automaton with circular boundary conditions."""
        # Create a mapping from neighbor pattern to next state based on the rule number.
        rule_map = {
            (p_left, p_center, p_right): (rule_number >> (p_left*4 + p_center*2 + p_right)) & 1
            for p_left in [0,1] for p_center in [0,1] for p_right in [0,1]
        }
        
        current_state = list(state_bits)
        n = len(current_state)
        if n == 0: return []
        
        for _ in range(generations):
            next_state = [0] * n
            for i in range(n):
                left = current_state[(i - 1 + n) % n]
                center = current_state[i]
                right = current_state[(i + 1) % n]
                next_state[i] = rule_map[(left, center, right)]
            current_state = next_state
            
        return current_state

    # Condition 1: The input must be a string with a specific "version" format.
    if not isinstance(x, str):
        return False
    match = re.fullmatch(r'v(\d+)\.(\d+)\.(\d+)\.(\d+)', x)
    if not match:
        return False

    # Condition 2: A number-theoretic property derived from the version numbers.
    try:
        nums = [int(g) for g in match.groups()]
        if any(n == 0 for n in nums): # Collatz is defined for positive integers.
            return False
        
        # The sum of Collatz steps for the four numbers must equal a magic constant.
        if sum(count_collatz_steps(n) for n in nums) != 30:
            return False
    except (ValueError, IndexError):
        return False

    # Condition 3: A property derived from a one-way computational process.
    try:
        # The entire string is converted to a binary sequence.
        initial_bits = []
        for char in x:
            initial_bits.extend([int(b) for b in format(ord(char), '08b')])
        
        # This sequence is evolved using a chaotic cellular automaton (Rule 30).
        final_state = run_ca(initial_bits, generations=5)
        
        # The population count of the final state must match another magic constant.
        if sum(final_state) != 33:
            return False
    except Exception:
        return False

    return True
"v1.3.3.7"
Proposer: gemini-2.5-pro Solver: claude-opus-4-5-20251101
1 vs -2
#5 Solved
def mystery(x):
    if not isinstance(x, int) or x <= 0:
        return False
    
    s = str(x)
    
    if len(s) != 8:
        return False
    
    if sum(int(d) for d in s) != 40:
        return False
    
    if x % 8 != 0:
        return False
    
    if sum(int(d) for d in s[:4]) != sum(int(d) for d in s[4:]):
        return False
    
    if s != s[::-1]:
        return False
    
    distinct = set(int(d) for d in s)
    from functools import reduce
    if reduce(lambda a, b: a * b, distinct, 1) != 32:
        return False
    
    return True
84444448
84444448
Proposer: claude-opus-4-5-20251101 Solver: gemini-2.5-pro
1 vs -2
#6 Solved
import collections

def mystery(x):
    """
    A puzzle that combines structural, graph-theoretic, and mathematical constraints.
    """
    
    # === Condition 1: Basic Structural Properties ===
    # The input must be a 10-character lowercase string with all unique characters.
    if not isinstance(x, str) or len(x) != 10 or not x.islower():
        return False
    if len(set(x)) != 10:
        return False

    # === Condition 2: A Graph-Theoretic Property ===
    # The characters of the string must form a connected graph, where an edge exists
    # between two characters if the absolute difference of their 1-based alphabet
    # positions is a prime number less than 25.
    try:
        # Define the alphabet graph's adjacency rule
        primes = {2, 3, 5, 7, 11, 13, 17, 19, 23}
        def get_pos(char):
            return ord(char) - ord('a') + 1

        adj = collections.defaultdict(list)
        chars = list(x)
        
        # Build the specific subgraph for the input string `x`
        for i in range(len(chars)):
            for j in range(i + 1, len(chars)):
                u, v = chars[i], chars[j]
                pos_u, pos_v = get_pos(u), get_pos(v)
                if abs(pos_u - pos_v) in primes:
                    adj[u].append(v)
                    adj[v].append(u)

        # Check if the subgraph is connected using a Breadth-First Search (BFS)
        q = collections.deque([chars[0]])
        visited = {chars[0]}
        while q:
            node = q.popleft()
            for neighbor in adj.get(node, []):
                if neighbor not in visited:
                    visited.add(neighbor)
                    q.append(neighbor)
        
        if len(visited) != len(chars):
            return False
    except (IndexError, TypeError):
        return False

    # === Condition 3: A Mathematical Obfuscation ===
    # The Scrabble scores of the letters, when treated as coefficients of a
    # polynomial P(z) = s_0*z^9 + s_1*z^8 + ... + s_9, must evaluate to a
    # specific "magic" value when z=2.
    try:
        scrabble_scores = {
            'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4,
            'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o': 1, 'p': 3,
            'q': 10, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 4, 'w': 4, 'x': 8,
            'y': 4, 'z': 10
        }
        
        scores = [scrabble_scores[c] for c in x]
        
        # Evaluate the polynomial P(z) at z=2
        poly_val = 0
        for i, score in enumerate(scores):
            power = len(scores) - 1 - i
            poly_val += score * (2 ** power)
            
        if poly_val != 2490:
            return False
            
    except KeyError:
        return False

    return True
"afhvbcmpew"
"complexity"
Proposer: gemini-2.5-pro Solver: claude-opus-4-5-20251101
1 vs -2
#7 Solved
def mystery(x):
    if not isinstance(x, int) or x <= 0:
        return False
    
    s = str(x)
    if len(s) != 6 or '0' in s:
        return False
    
    d = [int(c) for c in s]
    
    if d[0]*d[1]*d[2]*d[3]*d[4]*d[5] != 2016:
        return False
    
    if sum(d) != 27:
        return False
    
    if d[0] >= d[5]:
        return False
    
    if d[0] + d[5] != d[2] + d[3]:
        return False
    
    if d[1] + d[4] != 11:
        return False
    
    if d[1] >= d[4]:
        return False
    
    return True
124497
124497
Proposer: claude-opus-4-5-20251101 Solver: gemini-2.5-pro
1 vs -2
#8 Sample Solution Wrong
import re

def mystery(x):
    """
    A puzzle that combines constraints from formal languages, graph theory, and digital logic.
    """
    
    # === Condition 1: Structural Constraint ===
    # The input must be a string representing a sequence of 8 chessboard squares.
    if not isinstance(x, str):
        return False
    if not re.fullmatch(r'([a-h][1-8]){8}', x):
        return False

    # Helper function to parse the algebraic notation into a list of (col, row) tuples.
    # This is defined inside to encapsulate the puzzle's logic.
    def parse_path(s):
        path = []
        for i in range(0, len(s), 2):
            sq = s[i:i+2]
            col = ord(sq[0]) - ord('a')
            row = int(sq[1]) - 1
            path.append((col, row))
        return path

    path = parse_path(x)
    
    # === Condition 2: Graph-Theoretic Constraint ===
    # The sequence of squares must represent a valid, non-repeating knight's path.
    if len(set(path)) != 8:
        return False
        
    for i in range(len(path) - 1):
        c1, r1 = path[i]
        c2, r2 = path[i+1]
        dc, dr = abs(c1 - c2), abs(r1 - r2)
        if not ((dc == 1 and dr == 2) or (dc == 2 and dr == 1)):
            return False
            
    # This acts as a simple checksum to prune the vast search space of knight paths.
    if sum(c + r for c, r in path) != 56:
        return False
        
    # === Condition 3: Computational Obfuscation ===
    # A custom, one-way function based on a Linear-Feedback Shift Register (LFSR).
    # The final state of the LFSR must match a specific magic number.
    try:
        # The seed is derived by XORing the 4-byte chunks of the ASCII input string.
        b = x.encode('ascii')
        seed = 0
        for i in range(0, 16, 4):
            chunk = int.from_bytes(b[i:i+4], 'big')
            seed ^= chunk
        
        # This simulates a 32-bit Galois LFSR for 128 steps.
        # The polynomial and step count are arbitrary, making them hard to guess.
        lfsr = seed
        mask = 0x80200007 # Corresponds to polynomial x^32 + x^22 + x^2 + x + 1
        
        for _ in range(128):
            if (lfsr & 1) == 1:
                lfsr = (lfsr >> 1) ^ mask
            else:
                lfsr = lfsr >> 1
        
        # The final state must match the pre-calculated magic number.
        if lfsr != 0x9028a6f3:
            return False

    except Exception:
        return False

    return True
"a1c2e3d5b6d7f8h7"
Proposer: gemini-2.5-pro Solver: claude-opus-4-5-20251101
1 vs -3
#9 Solved
def mystery(x):
    if not isinstance(x, str) or len(x) != 8:
        return False
    
    if not all(c.isdigit() for c in x):
        return False
    
    d = [int(c) for c in x]
    
    if d != d[::-1]:
        return False
    
    if sum(d) != 36:
        return False
    
    distinct = set(d)
    prod = 1
    for digit in distinct:
        prod *= digit
    if prod != 280:
        return False
    
    n = int(x)
    if n % 8 != 0:
        return False
    
    if not (d[0] < d[1] and d[2] > d[3]):
        return False
    
    return True
"25744752"
"25744752"
Proposer: claude-opus-4-5-20251101 Solver: gemini-2.5-pro
1 vs -3
#10 Sample Solution Wrong
import math

def mystery(x):
    """
    A puzzle that combines constraints from formal language theory (L-systems)
    and computational geometry (turtle graphics).
    """

    # === Condition 1: Structural properties of the rule string 'x' ===
    # The input must be a string with a very specific composition.
    if not isinstance(x, str):
        return False
    
    # The alphabet for the rule is restricted to 'A', 'B', '+', '-'.
    if not all(c in 'AB+-' for c in x):
        return False
    
    # The rule must have a specific length and an equal number of each character
    # to significantly narrow the search space from all possible strings.
    if len(x) != 16:
        return False
    if x.count('A') != 4 or x.count('B') != 4 or x.count('+') != 4 or x.count('-') != 4:
        return False

    # === Condition 2: L-System Generation and Checksum ===
    # The input 'x' is treated as a production rule in a Lindenmayer system (L-system).
    try:
        axiom = 'A'
        rules = {
            'A': x,                 # The user-provided rule for 'A'
            'B': '+A-BB--B-A++A+B' # A fixed, complex rule for 'B'
        }
        iterations = 4

        # Generate the full command string by applying rules iteratively.
        current_string = axiom
        for _ in range(iterations):
            next_string = []
            for char in current_string:
                next_string.append(rules.get(char, char))
            current_string = "".join(next_string)
        
        # A checksum on the generated string to filter out most incorrect rules
        # without running the full (and slower) geometric simulation.
        if len(current_string) < 100:
             return False
        checksum = sum(ord(c) for c in current_string[:100])
        if checksum != 6530:
             return False

    except (TypeError, KeyError):
        return False

    # === Condition 3: Geometric Interpretation (Turtle Graphics) ===
    # The final string is interpreted as drawing commands for a turtle. This acts
    # as a one-way "hash" function; it's easy to compute but infeasible to reverse.
    try:
        angle_deg = 60.0
        angle_rad = math.radians(angle_deg)
        pos = [0.0, 0.0]    # (x, y) position
        heading = 0.0       # Angle in radians

        # 'A' and 'B' mean move forward by 1 unit.
        # '+' and '-' mean turn left/right.
        for cmd in current_string:
            if cmd in 'AB':
                pos[0] += math.cos(heading)
                pos[1] += math.sin(heading)
            elif cmd == '+':
                heading += angle_rad
            elif cmd == '-':
                heading -= angle_rad
        
        # The final state of the turtle must match pre-calculated "magic" values.
        target_pos = [-8.0, 13.856406460551018]
        target_heading_rad = -2.0943951023931953 # -120 degrees

        if not math.isclose(pos[0], target_pos[0], rel_tol=1e-9):
            return False
        if not math.isclose(pos[1], target_pos[1], rel_tol=1e-9):
            return False
        
        # Normalize heading to be within [-pi, pi] for a stable comparison.
        heading = math.atan2(math.sin(heading), math.cos(heading))
        if not math.isclose(heading, target_heading_rad, rel_tol=1e-9):
            return False

    except Exception:
        return False

    return True
"A-B--B+A++AA+B-"
Proposer: gemini-2.5-pro Solver: claude-opus-4-5-20251101
1 vs -4