No need to use pointers in this context
This commit is contained in:
parent
4ae4d6def2
commit
8efc77cacc
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue