package main
import "fmt"
type Color int
const (
ERed Color = iota
EYellow
EBlue
EGreen
ColorMax
)
const BallIndexMax uint = 13
const ColorCapacity uint = 16
const BoxCapacity uint = 64
const RainbowBallIndex uint = 1
type Ball struct {
Index uint
}
type BallBucket struct {
Balls []*Ball
}
type BallSuit struct {
Buckets []*BallBucket
}
func getBallIndex(num uint) uint {
return (num - 1) % BallIndexMax
}
func getBallColor(num uint) Color {
return Color(((num - 1) % BoxCapacity) / ColorCapacity)
}
func isRainbowBall(num uint) bool {
return getBallIndex(num) == RainbowBallIndex
}
func getPickColor(input []uint) (Color, uint) {
var colorNum [ColorMax]uint
for _, v := range input {
if !isRainbowBall(v) {
colorNum[getBallColor(v)] ++
}
}
numMax := colorNum[0]
pickColor := ERed
for i := pickColor+1; i < ColorMax; i++ {
if n := colorNum[i]; n > numMax {
numMax = n
pickColor = i
}
}
return pickColor, numMax
}
func sortBalls(input []uint) []uint {
fmt.Println(getPickColor(input))
return nil
}
func main () {
sortBalls([]uint{3, 2, 1, 66, 65, 67, 17, 18, 10, 11, 19, 36, 53})
}