From 15af19f442f65fe1d958971d26c882ac8e655422 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 4 Dec 2023 19:41:29 +0000 Subject: [PATCH] move Card struct into one.go --- day-4/one.go | 9 +++++++++ day-4/two.go | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/day-4/one.go b/day-4/one.go index d806877..fa54c38 100644 --- a/day-4/one.go +++ b/day-4/one.go @@ -5,6 +5,15 @@ import ( "unicode" ) +// Card represents a single card. +// it tracks its number of matches and occurrences +type Card struct { + matches int + occurrences int +} + +var cards = []Card{} + // one computes points based on matching numbers func one(lines []string) (int, error) { f := func(c rune) bool { diff --git a/day-4/two.go b/day-4/two.go index 8732ca5..96b9754 100644 --- a/day-4/two.go +++ b/day-4/two.go @@ -1,14 +1,5 @@ package main -// Cards represents a single card. -// it tracks its matching numbers and occurrences -type Card struct { - matches int - occurrences int -} - -var cards = []Card{} - // two returns the total number of occurrences for all cards func two(lines []string) (int, error) { var sum = 0