• 1 Post
  • 19 Comments
Joined 1 year ago
cake
Cake day: July 3rd, 2023

help-circle


  • import re
    numbers = {
        "one" : 1,
        "two" : 2,
        "three" : 3,
        "four" : 4,
        "five" : 5,
        "six" : 6,
        "seven" : 7,
        "eight" : 8,
        "nine" : 9
        }
    for digit in range(10):
        numbers[str(digit)] = digit
    pattern = "(%s)" % "|".join(numbers.keys())
       
    re1 = re.compile(".*?" + pattern)
    re2 = re.compile(".*" + pattern)
    total = 0
    for line in open("input.txt"):
        m1 = re1.match(line)
        m2 = re2.match(line)
        num = (numbers[m1.group(1)] * 10) + numbers[m2.group(1)]
        total += num
    print(total)
    

    There weren’t any zeros in the training data I got - the text seems to suggest that “0” is allowed but “zero” isn’t.












  • It was a staple of Asimov’s books that while trying to predict decisions of the robot brain, nobody in that world ever understood how they fundamentally worked.

    He said that while the first few generations were programmed by humans, everything since that was programmed by the previous generation of programs.

    This leads us to Asimov’s world in which nobody is even remotely capable of creating programs that violate the assumptions built into the first iteration of these systems - are we at that point now?