shiftos-next/shiftos_next/APIs/TerminalGames.vb
TheUltimateHacker 424931951b Shiftorium - Draggable Windows upgrade + Bugfixes
Alright, I've added the Draggable Windows upgrade to the Shiftorium, as
well as fixed a quick bug causing "No Items Available" to display when
there were items clearly available.

I've also fixed a positioning bug with BWM windows causing them to start
in the center of the screen, relative to the titlebar, rather than the
form.

I've also re-arranged the code a bit, organizing files in folders. APIs
are in the APIs folder, Desktop Environments are in the Desktop
Environments folder, etc.

The shiftorium still doesn't have draggable window functionality yet...
2015-05-28 21:42:26 -04:00

94 lines
3.4 KiB
VB.net

Module TerminalGames
Public mathquiz As Boolean = False
Public guessthenumber As Boolean = False
Public Sub MQInterpret(question As String, answer As Integer)
Dim random As New Random()
Dim correct As Boolean = False
Dim args() As String = question.Replace("What is ", "").Split(" ")
Dim cptoadd As Integer = random.Next(1, 5)
Select Case args(1)
Case "+"
correct = (answer = CInt(args(0)) + CInt(args(2)))
Case "-"
correct = (answer = args(0) - args(2))
Case "*"
correct = (answer = args(0) * args(2))
Case "/"
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
Public Sub MQCreateQuestion()
Dim rand As New Random
Dim num1 As Integer = rand.Next(1, 10)
Dim num2 As Integer = rand.Next(1, 10)
Dim operandchooser As Integer = rand.Next(1, 4)
Dim operand As String
Select Case operandchooser
Case 1
operand = " + "
Case 2
While num2 > num1
num2 = rand.Next(1, 10)
End While
operand = " - "
Case 3
operand = " * "
Case 4
operand = " / "
Case Else
operand = " + "
End Select
AddLine("What is " & num1 & operand & num2 & " ?")
End Sub
Public Sub changeinterpreter()
If mathquiz = True Then
AddLine(" === MathQuiz ===" & vbNewLine)
AddLine("MathQuiz is a basic game for ShiftOS that allows you to earn Codepoints for solving math " & vbNewLine & "questions. These questions will always be (num1) (operand) (num2) = (answer)." & vbNewLine)
AddLine("(num1) and (num2) will always be integers between 1 and 10.")
AddLine("(operand) Will always be either a +, -, * (times) or / (division) statement that can change the answer.")
MQCreateQuestion()
End If
If guessthenumber = True Then
AddLine(" -= Guess The Number =-" & vbNewLine)
AddLine("Guess the Number is a game that allows you to earn Codepoints for")
AddLine("guessing a number between 1 and 100." & vbNewLine)
GTNStart()
End If
End Sub
Public GTNCorrect As Integer
Public Sub GTNStart()
Dim rand As New Random()
GTNCorrect = rand.Next(1, 100)
AddLine("Choose a number between 1 and 100:")
End Sub
Public Sub GTNInterpret(num As Integer)
If num < 100 And num > 0 Then
If GTNCorrect = num Then
Dim rand As New Random()
Dim cptoadd As Integer = rand.Next(1, 10)
AddLine("Correct! You have earned " & cptoadd & " Codepoints.")
GTNStart()
ElseIf num > GTNCorrect Then
AddLine("Lower!")
ElseIf num < GTNCorrect Then
AddLine("Higher!")
End If
Else
AddLine("Number isn't between 1 and 100!")
End If
End Sub
End Module