cscg24-haunted

CSCG 2024 Challenge 'Haunted'
git clone https://git.sinitax.com/sinitax/cscg24-haunted
Log | Files | Refs | sfeed.txt

parse.py (578B)


      1
      2lines = open("log").read().split("\n")
      3lines = [l.strip() for l in lines if l.strip() != ""]
      4
      5switches = []
      6for i,line in enumerate(lines):
      7    if line == "SMM: enter":
      8        switches.append([lines[i+1:i+21],])
      9    elif line == "SMM: after RSM":
     10        switches[-1].append(lines[i+1:i+21])
     11
     12for before,after in switches:
     13    if before != after:
     14        print("---")
     15        for i in range(20):
     16            if before[i] != after[i]:
     17                print("<", before[i])
     18        for i in range(20):
     19            if before[i] != after[i]:
     20                print(">", after[i])
     21