Exemple #1
0
def subtractTest(a, b):
    io.printTTS("Calculate a - b")
    io.printTTS("{} - {} = ".format(a, b))
    ans = io.readInt()
    while ans != (a - b):
        io.printTTS(emoji.emojize(':thumbs_down: :thumbs_down: :thumbs_down: '), "Wrong! Please calculate the value again")
        ans = io.readInt()

    io.printTTS(emoji.emojize(':thumbs_up: :thumbs_up: :thumbs_up: ') + "You got it. The correct answer is {}".format(ans))
Exemple #2
0
def addTest(a, b):
    io.printTTS("Calculate a + b")
    io.printTTS("{} + {} = ".format(a, b))
    ans = io.readInt()
    while ans != (a + b):
        io.printTTS("Wrong! Please calculate the value again")
        ans = io.readInt()

    io.printTTS("You got it. The correct answer is {}".format(ans))
Exemple #3
0
def decomposeNumBaseTen(n):
    io.printTTS("Subtract 10")
    io.printTTS("{} - 10 = ".format(n))

    ans = io.readInt()
    res = ca.checkEqual(ans, n - 10)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        res = ca.checkEqual(ans, n - 10)

    io.printTTS("So we know that {} = {} - {}".format(n - 10, n, 10))
Exemple #4
0
def composeNumBaseTen(n):
    io.printTTS("Add numbers based on 10")
    io.printTTS("10 + {} = ".format(n))

    ans = io.readInt()
    res = ca.checkEqual(ans, n + 10)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        res = ca.checkEqual(ans, n + 10)

    io.printTTS("So we know that {} = {} + {}".format(10 + n, 10, n))
Exemple #5
0
def AddupNum(m, n, n1):
    io.printTTS("Add up numbers")
    io.printTTS("Joy has {} {}".format(n1, m))
    pitem.emojiPrint(m, n1)
    io.printTTS("How many more {}s Joy need to buy so she will have {} {}s?".format(m, n, m))

    ans = io.readInt()
    pitem.emojiPrint(m, ans)
    res = ca.checkEqual(ans, n - n1)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        pitem.emojiPrint(m, ans)
        res = ca.checkEqual(ans, n - n1)
    
    io.printTTS("So we know that {} = {} + {}".format(n, n1, n - n1))
Exemple #6
0
def decomposeObjBaseTen(m, n):
    io.printTTS("Take 10 objects away")
    io.printTTS("Bob has {} {}s".format(n, m))
    pitem.emojiPrint(m, n)
    io.printTTS("Joy takes 10 {}s away".format(m))
    pitem.emojiPrint(m, 10)
    io.printTTS("How many {}s does Bob have now?".format(m))

    ans = io.readInt()
    pitem.emojiPrint(m, ans)
    res = ca.checkEqual(ans, n - 10)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        pitem.emojiPrint(m, ans)
        res = ca.checkEqual(ans, n - 10)

    io.printTTS("So we know that {} = {} - {}".format(n - 10, n, 10))
Exemple #7
0
def composeObjBaseTen(m, n):
    io.printTTS("Add objects based on 10")
    io.printTTS("Bob has 10 {}s".format(m))
    pitem.emojiPrint(m, 10)
    io.printTTS("Joy gives Bob {} more {}s".format(n, m))
    pitem.emojiPrint(m, n)
    io.printTTS("How many {}s does Bob have now?".format(m))

    ans = io.readInt()
    pitem.emojiPrint(m, ans)
    res = ca.checkEqual(ans, n + 10)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        pitem.emojiPrint(m, ans)
        res = ca.checkEqual(ans, n + 10)

    io.printTTS("So we know that {} = {} + {}".format(10 + n, 10, n))
Exemple #8
0
def DecomposeNum(m, n, n1):
    io.printTTS("Decompose numbers")
    io.printTTS("We have {} {}".format(n, m))
    pitem.emojiPrint(m, n)
    io.printTTS("We give Joy {} {}".format(n1, m))
    pitem.emojiPrint(m, n1)
    io.printTTS("How many {} are left?".format(m))

    ans = io.readInt()
    pitem.emojiPrint(m, ans)
    res = ca.checkEqual(ans, n - n1)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        pitem.emojiPrint(m, ans)
        res = ca.checkEqual(ans, n - n1)

    io.printTTS("So we know that {} - {} = {}".format(n, n1, n - n1))
Exemple #9
0
def SubObjects(m, n1, n2):
    io.printTTS("Subtract objects")
    io.printTTS("Bob has {} {}".format(n1, m))
    pitem.emojiPrint(m, n1)
    io.printTTS("Joy takes away {} {} from Bob".format(n2, m))
    pitem.emojiPrint(m, n2)
    io.printTTS("How many {} does Bob have now?".format(m))

    ans = io.readInt()
    pitem.emojiPrint(m, ans)
    res = ca.checkEqual(ans, n1 - n2)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        pitem.emojiPrint(m, ans)
        res = ca.checkEqual(ans, n1 - n2)

    io.printTTS("So we know that {} - {} = {}".format(n1, n2, n1 - n2))
Exemple #10
0
def AddObjects(m, n1, n2):
    io.printTTS("Add objects")
    io.printTTS("Bob has {} {}".format(n1, m))
    pitem.emojiPrint(m, n1)
    io.printTTS("Joy has {} {}".format(n2, m))
    pitem.emojiPrint(m, n2)
    io.printTTS("How many {} do they have in total?".format(m))

    ans = io.readInt()
    pitem.emojiPrint(m, ans)
    res = ca.checkEqual(ans, n1 + n2)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        pitem.emojiPrint(m, ans)
        res = ca.checkEqual(ans, n1 + n2)

    io.printTTS("So we know that {} + {} = {}".format(n1, n2, n1 + n2))
Exemple #11
0
def countInShapes(m, n, s):
    io.printTTS("Count objects in {}".format(s))
    pitem.emojiPrint(m, n)
    io.printTTS("How many {} do you see?".format(m))

    ans = io.readInt()
    if ans == n:
        io.printTTS('Correct')
    else:
        io.printTTS('Wrong')
Exemple #12
0
def countObjects(m, n):
    io.printTTS("Count objects")
    pitem.emojiPrint(m, n)
    io.printTTS("How many {} do you see?".format(m))

    ans = io.readInt()
    if ans == n:
        io.printTTS('Correct')
    else:
        io.printTTS('Wrong')
Exemple #13
0
def ClassifyCount(m1, n1, m2, n2, m3, n3):
    l = [m1] * n1 + [m2] * n2 + [m3] * n3
    r = random.SystemRandom()
    r.shuffle(l)
    pitem.emojiPrintList(l)

    io.printTTS("How many {} do you see?".format(m1))
    ans = io.readInt()
    res = ca.checkEqual(ans, n1)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        res = ca.checkEqual(ans, n1)

    io.printTTS("How many {} do you see?".format(m2))
    ans = io.readInt()
    res = ca.checkEqual(ans, n2)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        res = ca.checkEqual(ans, n2)

    io.printTTS("How many {} do you see?".format(m3))
    ans = io.readInt()
    res = ca.checkEqual(ans, n3)
    while not res:
        io.printTTS("Double check")
        ans = io.readInt()
        res = ca.checkEqual(ans, n3)
Exemple #14
0
def guessValue(a):
    io.printTTS("Guess value in range 100")

    while 1:
        try:
            line = io.readInt()
        except KeyboardInterrupt:
            break
    
        if not line:
            break
    
        if line < a:
            io.printTTS("Guessed value is too small")
            io.printTTS("Guess the value again:")
            continue
        if line > a:
            io.printTTS("Guessed value is too big")
            io.printTTS("Guess the value again:")
            continue
    
        io.printTTS("You got it, the value is {}".format(a))
        break
Exemple #15
0
def main():
    if settings.guiflag:
        GUI.KidsMath().mainloop()
        sys.exit(1)

    print(">>>> Welcome to KidsMath, Enjoy! <<<<")

    grade = chooseGrade()
    k = TestCases(grade)
    while not k:
        io.printTTS("Selected Grade {} has not been implemented yet".format(k))
        grade = chooseGrade()
        k = TestCases(grade)

    object_methods = [
        method_name for method_name in dir(k)
        if callable(getattr(k, method_name))
    ]
    object_methods = CTR.RemoveSysMethods(object_methods)

    io.printTTS("There are totally {} test cases implemented".format(
        len(object_methods)))

    io.printTTS("Please specify how many tests you want try:")
    testcnt = io.readInt()

    RandomMethodList = []
    for i in range(testcnt):
        secure_random = random.SystemRandom()
        m = secure_random.choice(object_methods)
        RandomMethodList.append(m)
        object_methods.remove(m)

    print(RandomMethodList)
    # recursively call all the test cases
    for name in RandomMethodList:
        getattr(k, name)()
Exemple #16
0
def Name2Number(a):
    print('Write {} in number:'.format(a))
    ans = io.readInt()
    CA.checkEqual(ans, w2n.word_to_num(a))