44 lines
995 B
Go
44 lines
995 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gx-proj/tools"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
var availableSlave []int
|
|
var n, temp int
|
|
fmt.Println("Input the number of slaves:")
|
|
fmt.Scan(&n)
|
|
fmt.Println("Input the available slaves:")
|
|
for i := 0; i < n; i++ {
|
|
fmt.Scanf("%v", &temp)
|
|
availableSlave = append(availableSlave, temp)
|
|
}
|
|
fmt.Println("Checking available slaves...")
|
|
for _, i := range availableSlave {
|
|
if !tools.CheckSlave(i, 0) {
|
|
fmt.Println("Slave", i, "is not available")
|
|
os.Exit(0)
|
|
}
|
|
}
|
|
//availableSlave=append(availableSlave,3)
|
|
fmt.Println("\nAvailable slaves:", availableSlave)
|
|
fmt.Println("Please press any key to continue")
|
|
var input string
|
|
_, err := fmt.Scanln(&input)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// query the slaves to get score
|
|
var scoreMap = make(map[int]int)
|
|
for _, slave := range availableSlave {
|
|
fmt.Println("\nChecking slave", slave)
|
|
score := tools.GetGrade(slave, 0)
|
|
scoreMap[slave] = score
|
|
}
|
|
fmt.Println("\nScore statistics:", scoreMap)
|
|
tools.Reset()
|
|
}
|