No need to use pointers in this context

This commit is contained in:
Tyler 2019-10-13 04:45:33 -04:00
parent 4ae4d6def2
commit 8efc77cacc
1 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ type balancePenalty struct {
} }
func BestNodeByPenalties(nodes []*Node) (*Node, error) { func BestNodeByPenalties(nodes []*Node) (*Node, error) {
penalties := make([]*balancePenalty, len(nodes)) penalties := make([]balancePenalty, len(nodes))
var playerPenalty, cpuPenalty, deficitFramePenalty, nullFramePenalty int var playerPenalty, cpuPenalty, deficitFramePenalty, nullFramePenalty int
@ -32,7 +32,7 @@ func BestNodeByPenalties(nodes []*Node) (*Node, error) {
} }
} }
penalties[i] = &balancePenalty{node, playerPenalty + cpuPenalty + deficitFramePenalty + nullFramePenalty} penalties[i] = balancePenalty{node, playerPenalty + cpuPenalty + deficitFramePenalty + nullFramePenalty}
} }
sort.SliceStable(penalties, func(i, j int) bool { sort.SliceStable(penalties, func(i, j int) bool {