mirror of
https://github.com/onyx-and-iris/aoc2023.git
synced 2024-11-15 15:10:49 +00:00
23 lines
377 B
Go
23 lines
377 B
Go
package main
|
|
|
|
type data struct {
|
|
dest int
|
|
source int
|
|
offset int
|
|
}
|
|
|
|
func newData(nums ...int) data {
|
|
return data{dest: nums[0], source: nums[1], offset: nums[2]}
|
|
}
|
|
|
|
func (d data) transform(start, end int) (int, int) {
|
|
f := func(x int) int {
|
|
return x - d.source + d.dest
|
|
}
|
|
return f(start), f(end - 1)
|
|
}
|
|
|
|
var dataMap = map[string][]data{}
|
|
|
|
var identifiers = []string{}
|