mirror of
https://github.com/Luzifer/aoc2019.git
synced 2024-12-22 05:51:16 +00:00
Initialize module, remove external dep
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
c5e14ed7f4
commit
38c9de6a8a
3 changed files with 14 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
/cover
|
/cover
|
||||||
day03_debug.png
|
day03_debug.png
|
||||||
|
go.sum
|
||||||
|
|
11
day03.go
11
day03.go
|
@ -3,12 +3,13 @@ package aoc2019
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
"image/png"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/llgcode/draw2d/draw2dimg"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -145,9 +146,13 @@ func debugDay3DrawImage(l1, l2 day3Line) error {
|
||||||
// Draw "home-point" in green
|
// Draw "home-point" in green
|
||||||
dest.SetRGBA(0, 0, color.RGBA{0x0, 0xff, 0x0, 0xff})
|
dest.SetRGBA(0, 0, color.RGBA{0x0, 0xff, 0x0, 0xff})
|
||||||
|
|
||||||
draw2dimg.SaveToPngFile("day03_debug.png", dest)
|
f, err := os.Create("day03_debug.png")
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "Unable to open output file")
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
return nil
|
return errors.Wrap(png.Encode(f, dest), "Unable to write image")
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDay3MinIntersectionDistance(l1, l2 day3Line, originX, originY int) int {
|
func getDay3MinIntersectionDistance(l1, l2 day3Line, originX, originY int) int {
|
||||||
|
|
5
go.mod
Normal file
5
go.mod
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module github.com/Luzifer/aoc2019
|
||||||
|
|
||||||
|
go 1.13
|
||||||
|
|
||||||
|
require github.com/pkg/errors v0.8.1
|
Loading…
Reference in a new issue