You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.0 KiB

package main
import (
"../lib"
"./correct"
"./student"
)
func main() {
functions := []func(string) bool{correct.IsNumeric, correct.IsLower, correct.IsUpper}
type node struct {
f func(string) bool
a []string
}
table := []node{}
for i := 0; i < 5; i++ {
function := functions[lib.RandIntBetween(0, len(functions)-1)]
table = append(table, node{
f: function,
a: lib.MultRandWords(),
})
}
for i := 0; i < 5; i++ {
table = append(table, node{
f: correct.IsNumeric,
a: lib.MultRandDigit(),
})
}
for i := 0; i < 5; i++ {
table = append(table, node{
f: correct.IsLower,
a: lib.MultRandLower(),
})
}
for i := 0; i < 5; i++ {
table = append(table, node{
f: correct.IsUpper,
a: lib.MultRandUpper(),
})
}
table = append(table,
node{
f: correct.IsNumeric,
a: []string{"Hello", "how", "are", "you"},
},
node{
f: correct.IsNumeric,
a: []string{"This", "is", "4", "you"},
},
)
for _, arg := range table {
lib.Challenge("Any", student.Any, correct.Any, arg.f, arg.a)
}
}