diff options
| author | pfgithub <[email protected]> | 2015-05-26 17:21:56 -0700 |
|---|---|---|
| committer | pfgithub <[email protected]> | 2015-05-26 17:21:56 -0700 |
| commit | 5dd935e56b65c2b29b63211abda3e9a3c5c4e851 (patch) | |
| tree | 49f1cc4af2effbe35d32ea8c5a883be5e5899cdc | |
| parent | 57e6eec1bc00eaedeb6004c225184ba03f1155e0 (diff) | |
| download | shiftos-next-5dd935e56b65c2b29b63211abda3e9a3c5c4e851.tar.gz shiftos-next-5dd935e56b65c2b29b63211abda3e9a3c5c4e851.tar.bz2 shiftos-next-5dd935e56b65c2b29b63211abda3e9a3c5c4e851.zip | |
Fix math quiz
Not tested
| -rw-r--r-- | shiftos_next/TerminalGames.vb | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/shiftos_next/TerminalGames.vb b/shiftos_next/TerminalGames.vb index fab93b3..3cb7ee2 100644 --- a/shiftos_next/TerminalGames.vb +++ b/shiftos_next/TerminalGames.vb @@ -5,41 +5,24 @@ Public Sub MQInterpret(question As String, answer As Integer) Dim random As New Random() + Private correct As Boolean = False Dim args() As String = question.Replace("What is ", "").Split(" ") Select Case args(1) Case "+" - If answer = args(0) + args(2) Then - Dim cptoadd As Integer = random.Next(1, 5) - AddLine("Correct! You have earned " & cptoadd & " Codepoints!") - AddCP(cptoadd) - Else - AddLine("Incorrect! Better luck next time...") - End If + correct = (answer = CInt(args(0)) + CInt(args(2))) Case "-" - If answer = args(0) - args(2) Then - Dim cptoadd As Integer = random.Next(1, 5) - AddLine("Correct! You have earned " & cptoadd & " Codepoints!") - AddCP(cptoadd) - Else - AddLine("Incorrect! Better luck next time...") - End If + correct = (answer = args(0) - args(2)) Case "*" - If answer = args(0) * args(2) Then - Dim cptoadd As Integer = random.Next(1, 5) - AddLine("Correct! You have earned " & cptoadd & " Codepoints!") - AddCP(cptoadd) - Else - AddLine("Incorrect! Better luck next time...") - End If + correct = (answer = args(0) * args(2)) Case "/" - If answer = args(0) / args(2) Then - Dim cptoadd As Integer = random.Next(1, 5) - AddLine("Correct! You have earned " & cptoadd & " Codepoints!") - AddCP(cptoadd) - Else - AddLine("Incorrect! Better luck next time...") - End If + correct = (answer = args(0) / args(2)) End Select + If (correct) Then + AddLine("Correct! You have earned " & cptoadd & " Codepoints!") + AddCP(cptoadd) + Else + AddLine("Incorrect! Better luck next time...") + End If MQCreateQuestion() End Sub |
