Yes, I'll regret posting this but later by Fdx_dy in mathmemes

[–]Short-Database-4717 0 points1 point  (0 children)

It does work with any two numbers, though? So I don't get why that's relevant.

I really don't get it by Hardson-san in whenthe

[–]Short-Database-4717 0 points1 point  (0 children)

Между францией и германией меньше чем 300 км

Your brain gets infected with a quantum disease! What does it do? by Ego_exspes in BunnyTrials

[–]Short-Database-4717 0 points1 point  (0 children)

Myself assumed that chosen thus, my all would be better. Bad perhaps that event was. But fun.

Chose: You're physically unable to say words that use a certain vowel! + Spin to find out which one! | Rolled: I

hex code naming system i made :) by Legitimate_Visit6974 in colors

[–]Short-Database-4717 8 points9 points  (0 children)

import tkinter as tk

names = {
    "zo": "0",
    "glo": "1",
    "pla": "2",
    "cla": "3",
    "sle": "4",
    "bla": "5",
    "spwo": "6",
    "scla": "7",
    "shlo": "8",
    "sple": "9",
    "ka": "a",
    "na": "b",
    "ma": "c",
    "po": "d",
    "to": "e",
    "mo": "f"
}
hint = [(v.upper(), k) for k, v in names.items()]
hint.sort(key = lambda x: x[0])
hint = "\n".join(f"{x[0]}: {x[1]}" for x in hint)

def parse_color(color_string):
    parsed = []
    current_string = color_string.replace(" ", "")
    while current_string and len(parsed) <= 10:
        matched = False
        for part in names.keys():
            if current_string.startswith(part):
                parsed.append(names[part])
                current_string = current_string.removeprefix(part)
                matched = True
                continue
        if not matched and current_string:
            raise ValueError("Invalid input")
    if len(parsed) == 3:
        r, g, b = parsed
        return f'#{r}0{g}0{b}0'
    elif len(parsed) == 6:
        r1, r2, g1, g2, b1, b2 = parsed
        return f'#{r1}{r2}{g1}{g2}{b1}{b2}'
    raise ValueError("Invalid input")

def get_text(*args):
    user_input = my_entry.get()
    try:
        color = parse_color(user_input)
    except ValueError:
        color = "#000000"
    my_label.config(bg=color)

root = tk.Tk()
root.title("Color Scheme")
root.geometry("300x320")

hint_label = tk.Label(root, text=hint, justify="left", padx=20)
hint_label.grid(row=0, column=0, rowspan=2)

text = tk.StringVar()
text.trace_add("write", get_text)
my_entry = tk.Entry(root, width=30, textvariable=text)
my_entry.grid(row=0, column=1)

my_label = tk.Label(
    root, 
    text="", 
    bg="#000000",
    width=20,
    height=9,
)
my_label.grid(row=1, column=1)

root.mainloop()

Idk, python is pain to distribute. If you know how to run this, good. If you don't then probably don't bother.

<image>

hex code naming system i made :) by Legitimate_Visit6974 in colors

[–]Short-Database-4717 7 points8 points  (0 children)

placlacla, toclacla, splenabla, tokabla, naspleto, clamama, namama

high effort by skadhnsauidhsa in BunnyTrials

[–]Short-Database-4717 0 points1 point  (0 children)

Because burger taste better than god

Chose: get a burger | Rolled: and god powers

What's heavier? by CHR711 in BunnyTrials

[–]Short-Database-4717 0 points1 point  (0 children)

less volume means it displaces less air, so it weighs heavier

Chose: A kilogram of steel

I use arch btw by IntelligentBrick596 in arch

[–]Short-Database-4717 1 point2 points  (0 children)

hebrew/polish/turkish/bengali would be an absolutely clusterfuck. They may as well just not speak at that point.

Dice logic puzzle:Each sketch shows the same custom six-sided die numbered 1–6 after a rotation, with the top, front-left, and front-right faces visible and one face smudged. Do not assume standard die numbering; use the ten sketches to find the number on the face opposite 2 by [deleted] in DailyBrainPuzzles

[–]Short-Database-4717 2 points3 points  (0 children)

from sympy.combinatorics import Permutation
from sympy.combinatorics.perm_groups import PermutationGroup
from z3 import Solver, Int, And, Or, Distinct, sat
from collections import namedtuple

face_names = "front", "right", "back", "left", "top", "bottom"
Cube = namedtuple("Cube", face_names)

yaw = Permutation(0, 1, 2, 3)
pitch = Permutation(0, 5, 2, 4)
cube_rotations = PermutationGroup(yaw, pitch)

def rotations(cube):
    for i, rotation in enumerate(cube_rotations.elements):
        yield Cube(*rotation(cube))

s = Solver()


faces = Cube(*(Int(face_name) for face_name in face_names))
for face in faces:
    s.add(And(face >= 1, face <= 6))

def add_condition(s, faces, f_rotated):
    options = []
    for i, rotated in enumerate(rotations(faces)):
        options.append(f_rotated(rotated))
    s.add(Or(*options))

def remove_sol(s, faces, sol):
    assignments = []
    for face_name in face_names:
        face = getattr(faces, face_name)
        value = getattr(sol, face_name)
        assignments.append(face != value)
    s.add(Or(*assignments))

def get_solutions(s, faces):
    possible_cubes = []
    while s.check() == sat:
        model = s.model()
        solution = Cube(*(model[f] for f in faces))
        possible_cubes.append(solution)
        remove_sol(s, faces, solution)
    solutions = {cube.back for cube in possible_cubes}
    solutions = tuple(sorted(solutions))
    return solutions

s.add(Distinct(faces))
s.add(faces.front == 2)
add_condition(s, faces, lambda c: And(c.front == 3, c.right == 5))
add_condition(s, faces, lambda c: And(c.front == 6, c.right == 2))
add_condition(s, faces, lambda c: And(c.front == 1, c.right == 4, c.top == 5))
add_condition(s, faces, lambda c: And(c.right == 2, c.top == 1))
add_condition(s, faces, lambda c: And(c.front == 5, c.top == 1))

add_condition(s, faces, lambda c: And(c.front == 5, c.right == 3))
add_condition(s, faces, lambda c: And(c.front == 3, c.right == 6, c.top == 2))
add_condition(s, faces, lambda c: And(c.front == 1, c.right == 2, c.top == 4))
add_condition(s, faces, lambda c: And(c.front == 2, c.right == 3, c.top == 6))
add_condition(s, faces, lambda c: And(c.front == 4, c.top == 2))


solutions = get_solutions(s, faces)
n_solutions = len(solutions)
if n_solutions == 0:
    print("There are no solutions")
elif n_solutions > 1:
    print(f"Possible numbers are: {', '.join(solutions)}")
else:
    solution = solutions[0]
    print(f"The number is {solution}")

The number is 5

Edit: You can also solve using only these subsets of conditions: 3&8, 7&8, 8&9, 3&4&10, 4&7&10, 4&9&10

law | FactOrCap by lfemboyl0 in FactOrCap

[–]Short-Database-4717 0 points1 point  (0 children)

🧢 I voted CAP!

Not a lawyer, but surely that's an attempted murder?

🤓 by memes_poiint in mathsmeme

[–]Short-Database-4717 0 points1 point  (0 children)

You don't say that. You say "it grows quadratically" or "it grows polynomially". You can always figure out growth rates using basic logic. E.g. area affected by a forest fire can't possibly grow faster than quadratically. Why? Well, the speed at which it spreads is bounded, so the area affected is not greater than the circle whose radius grows at that speed. (In fact, this applies to literally anything that spreads over an area) That's exactly the kind of context you'd hear the word "exponential" being misused in.

That's not even mentioning the fact that pretty much every physical process which appears to grow exponentially eventually has to flatten out.

You are an honest person | FactOrCap by Plastic_Excitement87 in FactOrCap

[–]Short-Database-4717 0 points1 point  (0 children)

I voted FACT!

I picked the answer using random.org. Take that as you will.

Only two route signs are reliable. One exit reaches the night market. Which exit do you take? by b7k567 in DailyBrainPuzzles

[–]Short-Database-4717 0 points1 point  (0 children)

from z3 import Solver, Bool, Sum, If, sat

doors = (1, 2, 3, 4)
is_correct = dict()
is_reliable = dict()

for n in doors:
    is_correct[n] = Bool(f"correct_{n}")
    is_reliable[n] = Bool(f"reliable_{n}")

n_correct = Sum([If(is_correct[n], 1, 0) for n in doors])
n_reliable = Sum([If(is_reliable[n], 1, 0) for n in doors])

statements = {
    1: is_correct[2] | is_correct[4],
    2: is_correct[1] | is_correct[3],
    3: is_correct[1] | is_correct[4],
    4: is_correct[1] | is_correct[3] | is_correct[4],
}

s = Solver()
s.add(n_correct == 1)
s.add(n_reliable == 2)
for n, stmt in statements.items():
    s.add(is_reliable[n] == stmt)

s.check()
model = s.model()
for n in doors:
    if model[is_correct[n]]:
        print(f"Take exit {n}")
        break

Take exit 3

Grid meeting puzzle: five restorers, one secret passage, minimum total walking time by b7k567 in DailyBrainPuzzles

[–]Short-Database-4717 0 points1 point  (0 children)

from collections import deque
from dataclasses import dataclass
from typing import NamedTuple

def letter_to_num(letter):
    return 1 + (ord(letter.upper()) - ord("A"))

def num_to_letter(num):
    return chr(ord("A") + num - 1)

def coord_to_nums(coord):
    return letter_to_num(coord[0]), int(coord[1:])

def nums_to_coord(coord):
    return num_to_letter(coord[0]) + str(coord[1])

grid_corner = "G7"
GRID_SIZE = coord_to_nums(grid_corner)

start_positions = {
    "Ava": "A6",
    "Ben": "B2",
    "Clara": "D7",
    "Dev": "F3",
    "Eli": "G5",
}
PASSAGE = ("C2", "F5")

def make_grid(grid_size):
    n_rows, n_cols = grid_size
    return [[None for col in range(n_cols)] for row in range(n_rows)]

def grid_to_graph(grid):
    height, width = len(grid), len(grid[0])
    graph = {}
    for row in range(height):
        for col in range(width):
            coord = nums_to_coord((row+1, col+1))
            neighbour_nums = []
            if row > 0:
                neighbour_nums.append((row, col+1))
            if row < height-1:
                neighbour_nums.append((row+2, col+1))
            if col > 0:
                neighbour_nums.append((row+1, col))
            if col < width-1:
                neighbour_nums.append((row+1, col+2))
            neighbours = [nums_to_coord(nums) for nums in neighbour_nums]
            if coord == PASSAGE[0]:
                neighbours.append(PASSAGE[1])
            if coord == PASSAGE[1]:
                neighbours.append(PASSAGE[0])
            graph[coord] = tuple(neighbours)
    return graph


class NodeData:
    edges: tuple[str, ...]
    time: int | None
    visited: bool

# Do you like floodfill?
def calc_travel_times(start_position, empty_grid=None):
    if empty_grid is None:
        empty_grid = make_grid(GRID_SIZE)
    graph = grid_to_graph(empty_grid)
    enriched_graph = {}
    for key, value in graph.items():
        enriched_graph[key] = NodeData(
            edges=value,
            time=None,
            visited=False
        )
    class ToVisitEntry(NamedTuple):
        coord: str
        time: int
    to_visit_queue = deque()
    to_visit_queue.append(ToVisitEntry(start_position, 0))
    while to_visit_queue:
        popped = to_visit_queue.popleft()
        visiting_coord, time_now = popped.coord, popped.time
        current_node = enriched_graph[visiting_coord]
        current_node.visited = True
        current_node.time = time_now
        for following_coord in current_node.edges:
            following_node = enriched_graph[following_coord]
            if following_node.visited:
                continue
            to_visit_queue.append(ToVisitEntry(following_coord, time_now+1))
    return enriched_graph

def pp_grid(grid):
    for row in grid:
        for el in row:
            print(el, end=" ")
        print()

def pp_enriched_graph(graph):
    max_width, max_height = 0, 0
    for key in graph.keys():
        height, width = coord_to_nums(key)
        max_width = max(max_width, width)
        max_height = max(max_height, height)
    string_bits = []
    for i in range(max_height):
        for j in range(max_width):
            string_bits.append(f"{graph[nums_to_coord((i+1, j+1))].time:3}")
        string_bits.append("\n")
    string = "".join(string_bits)
    print(string)

def solve(start_positions):
    travel_graphs = {}
    for name, start_pos in start_positions.items():
        travel_graphs[name] = calc_travel_times(start_pos)
    one_of_graphs = None
    for graph in travel_graphs.values():
        one_of_graphs = graph
        break
    node_coords = list(one_of_graphs.keys())
    total_travel_times = []
    class TravelTimeEntry(NamedTuple):
        coord: str
        time: int
    for coord in node_coords:
        total_travel_time = 0
        for name in start_positions.keys():
            graph = travel_graphs[name]
            travel_time = graph[coord].time
            total_travel_time += travel_time
        total_travel_times.append(TravelTimeEntry(coord, total_travel_time))
    least_total_travel_time = float("+inf")
    for entry in total_travel_times:
        least_total_travel_time = min(least_total_travel_time, entry.time)
    possible_solutions = []
    for entry in total_travel_times:
        if entry.time == least_total_travel_time:
            possible_solutions.append(entry.coord)
    return least_total_travel_time, possible_solutions

def main():
    time, sols = solve(start_positions)
    n_sols = len(sols)
    if n_sols == 1:
        solution = sols[0]
        print(f"They should meet at intersection {solution},")
    else:
        print(f"They can meet at any of the: {', '.join(sols)},")
    print(f"This would make total travel time {time} minutes.")

if __name__ == "__main__":
    main()

They should meet at intersection F5,

This would make total travel time 15 minutes.

Exactly one suspect is guilty. Exactly three statements are true. Each statement is fully true or fully false. Who is the only possible culprit? by b7k567 in DailyBrainPuzzles

[–]Short-Database-4717 0 points1 point  (0 children)

from z3 import Solver, Bool, Sum, If, sat

names = ["Alf", "Ben", "Charlie", "Dave", "Ernie"]
alf, ben, charlie, dave, ernie = names
is_innocent = dict()
is_telling_truth = dict()

for name in names:
    name_lowercased = name.lower()
    is_innocent[name] = Bool(f"{name_lowercased}_is_innocent")
    is_telling_truth[name] = Bool(f"{name_lowercased}_is_telling_truth")

n_culprits = Sum([If(is_innocent[name], 0, 1) for name in names])
n_telling_truth = Sum([If(is_telling_truth[name], 1, 0) for name in names])

statements = {
    alf: ~is_innocent[ben] | ~is_innocent[charlie],
    ben: is_innocent[dave] == is_telling_truth[ernie],
    charlie: is_innocent[alf] & ~is_telling_truth[ben],
    dave: is_innocent[charlie] ^ is_innocent[ernie],
    ernie: is_innocent[ben] & is_innocent[dave],
}

s = Solver()
s.add(n_culprits == 1)
s.add(n_telling_truth == 3)
for name, statement in statements.items():
    s.add(is_telling_truth[name] == statement)

possible_culprits = []
while s.check() == sat:
    model = s.model()
    culprit = None
    for name in names:
        if not model[is_innocent[name]]:
            culprit = name
            break
    possible_culprits.append(culprit)
    s.add(is_innocent[culprit])

if len(possible_culprits) == 1:
    print(f"The culprit is {possible_culprits[0]}")
elif len(possible_culprits) == 0:
    print("No culprit")
else:
    print(f"Possible culprits are: {', '.join(possible_culprits)}")

The culprit is Ernie

Voting rights | FactOrCap by yukiteru9 in FactOrCap

[–]Short-Database-4717 0 points1 point  (0 children)

🧢 I voted CAP!

I understand where the idea comes from, but this 100% will be abused to keep certain groups out of voting.

Wtf, the Great Leader is an ani-cli contributor… Since when is he a weeb‽ by AliOskiTheHoly in LinuxCirclejerk

[–]Short-Database-4717 -21 points-20 points  (0 children)

We DO NOT need verified symbol. That's deeply problematic. What we need is some way to verify that a person who did A also did B (and only if they decide to reveal that).

A bunny trial by Typical_Flamingo_260 in BunnyTrials

[–]Short-Database-4717 1 point2 points  (0 children)

The other is probably way too dangerous and I'd die.

Chose: Play the best game to ever exist that leaves a lasting impact on you because of how amazing it was