You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main_test.go 524B

12345678910111213141516171819202122232425
  1. package main
  2. import (
  3. "github.com/csmith/aoc-2019/common"
  4. "testing"
  5. )
  6. func Benchmark(b *testing.B) {
  7. for i := 0; i < b.N; i++ {
  8. recipes := parseInput("input.txt")
  9. used := make(map[chemical]int, len(recipes))
  10. spare := make(map[chemical]int, len(recipes))
  11. recipes.produce("FUEL", 1, used, spare)
  12. orePerFuel := used["ORE"]
  13. last := 0
  14. for used["ORE"] < 1000000000000 {
  15. last = used["FUEL"]
  16. recipes.produce("FUEL", common.Max(1, (1000000000000-used["ORE"])/orePerFuel), used, spare)
  17. }
  18. _ = last
  19. }
  20. }