updated util packages

This commit is contained in:
alexchao26
2020-12-10 01:04:51 -05:00
parent b9a74cf122
commit 1fec4f74d3
47 changed files with 285 additions and 95 deletions
+6 -3
View File
@@ -9,12 +9,15 @@ Robot struct houses an Intcode computer and its RecursiveMove method populates a
package main
import (
"github.com/alexchao26/advent-of-code-go/util"
"fmt"
"log"
"math"
"strconv"
"strings"
"github.com/alexchao26/advent-of-code-go/algos"
"github.com/alexchao26/advent-of-code-go/mathutil"
"github.com/alexchao26/advent-of-code-go/util"
)
func main() {
@@ -333,7 +336,7 @@ func Draw(mapCoordsToType map[string]int) [][]int {
}
// Determine the bounds of the grid
edgeLength := 2 * util.MaxInts(-lowY, -lowX, highY, highX)
edgeLength := 2 * mathutil.MaxInt(-lowY, -lowX, highY, highX)
grid := make([][]int, edgeLength)
for i := 0; i < edgeLength; i++ {
@@ -359,7 +362,7 @@ func Draw(mapCoordsToType map[string]int) [][]int {
// trim off due to making the initial grid too large
grid = trim(grid)
// rotate it because of how I coded up the robot's coordinates :/
grid = util.RotateGridInts(grid)
grid = algos.RotateIntGrid(grid)
// retrim
grid = trim(grid)
+6 -3
View File
@@ -12,11 +12,14 @@ Robot struct houses an Intcode computer and its RecursiveMove method populates a
package main
import (
"github.com/alexchao26/advent-of-code-go/util"
"fmt"
"log"
"strconv"
"strings"
"github.com/alexchao26/advent-of-code-go/algos"
"github.com/alexchao26/advent-of-code-go/mathutil"
"github.com/alexchao26/advent-of-code-go/util"
)
func main() {
@@ -387,7 +390,7 @@ func Draw(mapCoordsToType map[string]int) [][]int {
}
// Determine the bounds of the grid
edgeLength := 2 * util.MaxInts(-lowY, -lowX, highY, highX)
edgeLength := 2 * mathutil.MaxInt(-lowY, -lowX, highY, highX)
grid := make([][]int, edgeLength)
for i := 0; i < edgeLength; i++ {
@@ -413,7 +416,7 @@ func Draw(mapCoordsToType map[string]int) [][]int {
// trim off due to making the initial grid too large
grid = trim(grid)
// rotate it because of how I coded up the robot's coordinates :/
grid = util.RotateGridInts(grid)
grid = algos.RotateIntGrid(grid)
// retrim
grid = trim(grid)