blob: a0e8523f98d0b843757c3ff492a7506ea388c0ea (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
Module App_MathQuiz
Public MQ_1stNum As Integer
Public MQ_2ndNum As Integer
Public MQ_Operation As String
Public MQ_ShouldResult As Integer
Public OperationChooser As Integer
Public Sub MQ_Start()
Console.DefaultPrompt = "> "
ResetLine("MathQuiz for ShiftOS")
NewLine("Answer basic arithmatical question and you'll get codepoints based on the answer")
NewLine(Nothing)
MQ_GiveQuestion()
Console.CurrentInterpreter = "mathquiz"
Console.ShouldChange = True
Console_Interpreters()
End Sub
Public Sub MQ_GiveQuestion()
Try
Dim RandomNum As New Random
MQ_1stNum = RandomNum.Next(1, 10)
MQ_2ndNum = RandomNum.Next(1, 10)
OperationChooser = RandomNum.Next(1, 5)
Select Case OperationChooser
Case 1
MQ_Operation = " + "
MQ_ShouldResult = MQ_1stNum + MQ_2ndNum
Case 2
While MQ_2ndNum >= MQ_1stNum
MQ_2ndNum = RandomNum.Next(1, 10)
End While
MQ_Operation = " - "
MQ_ShouldResult = MQ_1stNum - MQ_2ndNum
Case 3
MQ_Operation = " * "
MQ_ShouldResult = MQ_1stNum * MQ_2ndNum
Case 4
While MQ_2ndNum > MQ_1stNum
MQ_2ndNum = RandomNum.Next(1, 10)
End While
MQ_Operation = " / "
MQ_ShouldResult = MQ_1stNum / MQ_2ndNum
End Select
NewLine("What is " & MQ_1stNum & MQ_Operation & MQ_2ndNum & " ?")
Catch ex As Exception
NewLine(ex.Message)
TerminateApp(Nothing)
End Try
End Sub
Public Sub MQ_CheckAnswer()
Try
Dim TheAnswer As Integer = command
If TheAnswer = MQ_ShouldResult Then
NewLine("You got the right answer! You got " & MQ_ShouldResult & " Codepoint(s)")
ChangeCP(True, MQ_ShouldResult)
MQ_GiveQuestion()
Else
NewLine("You got the wrong answer! Try again")
MQ_GiveQuestion()
End If
Catch ex As Exception
NewLine("Invalid number or command")
End Try
End Sub
End Module
|