mirror of https://github.com/01-edu/public.git
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.
66 lines
1.3 KiB
66 lines
1.3 KiB
5 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/01-edu/z01"
|
||
|
)
|
||
|
|
||
5 years ago
|
func main() {
|
||
5 years ago
|
// Declaration of an empty array of type string
|
||
|
table := []string{}
|
||
|
|
||
|
// Filing of this array with the tests array provided.
|
||
|
table = append(table,
|
||
|
"CDCCDDCDCD",
|
||
|
"CDDDDCCCDC",
|
||
|
"DDDDCCCC",
|
||
|
"CDCCCDDCDD",
|
||
|
"CDCDCDCDCDCDCDCD",
|
||
|
"CCCDDDCDCCCCDC",
|
||
|
"DDDDDDDDDDDDDDDDDDDDDDDDCCCCCCCCCCCCCCCCCCCCCCCC",
|
||
|
"DDDDCDDDDCDDDCCC",
|
||
|
)
|
||
|
|
||
|
for i := 0; i < 15; i++ {
|
||
|
value := ""
|
||
|
chunks := z01.RandIntBetween(5, 10)
|
||
|
for j := 0; j < chunks; j++ {
|
||
|
countC := z01.RandIntBetween(1, 5)
|
||
|
countD := z01.RandIntBetween(1, 5)
|
||
|
tmpC := countC
|
||
|
tmpD := countD
|
||
|
for tmpC > 0 || tmpD > 0 {
|
||
|
letter := z01.RandStr(1, "CD")
|
||
|
if tmpC > 0 && letter == "C" {
|
||
|
tmpC--
|
||
|
value += letter
|
||
|
} else if tmpD > 0 && letter == "D" {
|
||
|
tmpD--
|
||
|
value += letter
|
||
|
}
|
||
|
}
|
||
|
|
||
|
tmpC = countC
|
||
|
tmpD = countD
|
||
|
for tmpC > 0 || tmpD > 0 {
|
||
|
letter := z01.RandStr(1, "CD")
|
||
|
if tmpC > 0 && letter == "D" {
|
||
|
tmpC--
|
||
|
value += letter
|
||
|
} else if tmpD > 0 && letter == "C" {
|
||
|
tmpD--
|
||
|
value += letter
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
table = append(table, value)
|
||
|
}
|
||
|
|
||
|
//The table with 8 specific exercises and 15 randoms is now ready to be "challenged"
|
||
|
//This time, contrary to the nauuo exercise,
|
||
|
//We can use the ChallengeMainExam function.
|
||
|
|
||
|
for _, arg := range table {
|
||
5 years ago
|
z01.ChallengeMain(arg)
|
||
5 years ago
|
}
|
||
|
}
|