day20, part2 done with online LCM calculator

This commit is contained in:
efim
2023-12-20 13:16:13 +00:00
parent 57fdfb01cb
commit 98206fe6d4
4 changed files with 318 additions and 13 deletions

View File

@@ -2,7 +2,6 @@ package day20
import (
"fmt"
"log"
"regexp"
"slices"
"strings"
@@ -93,7 +92,7 @@ func ParseFlipFlop(line string) (result FlipFlop) {
re := regexp.MustCompile(`%(?P<NAME>\D+) -> (?P<OUTPUTS>.+)`)
matches := re.FindStringSubmatch(line)
log.Printf("matching %s getting '%s' and '%s'\n", line, matches[1], matches[2])
// log.Printf("matching %s getting '%s' and '%s'\n", line, matches[1], matches[2])
result.Name = matches[1]
result.OutputNames = strings.Split(matches[2], ", ")
@@ -220,7 +219,7 @@ func ParseConjunction(line string) (result Conjunction) {
re := regexp.MustCompile(`&(?P<NAME>\D+) -> (?P<OUTPUTS>.+)`)
matches := re.FindStringSubmatch(line)
log.Printf("matching %s getting '%s' and '%s'\n", line, matches[1], matches[2])
// log.Printf("matching %s getting '%s' and '%s'\n", line, matches[1], matches[2])
result.Name = matches[1]
result.OutputNames = strings.Split(matches[2], ", ")
@@ -256,7 +255,7 @@ func (b *Button)MermaidFlow() string {
type Output struct {}
func (o *Output)Receive(s Signal) []Signal {
log.Print("Outut received signal: ", s)
// log.Print("Outut received signal: ", s)
return []Signal{}
}