Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Dim Binary As String
- Dim BinNum As Integer
- Dim HexOrDec As Integer
- Dim QType As Integer
- Dim Counter As Integer = 0
- Dim Counter2 As Boolean
- Dim Counter3 As Boolean
- Dim BinTo(2) As String
- Dim QuestionType As Integer
- Dim QuestionType2 As Integer
- Dim OutputHexOrDec As String
- Dim BinaryStr As String
- Dim BinaryStr2 As String
- Dim BinaryStr3 As String
- Dim BinaryStr4 As String
- Dim BinaryStr5 As String
- Dim BinaryStr6 As String
- Dim Bit1 As Integer
- Dim Bit2 As Integer
- Dim Bit3 As Integer
- Dim Bit4 As Integer
- Dim Bit5 As Integer
- Dim Bit6 As Integer
- Dim Bit7 As Integer
- Dim Bit8 As Integer
- Dim CarryBit As Integer
- Dim DecAnswer As Integer = 0
- Dim OverallAnswer As String
- Dim HexAnswer As String
- Dim UserAnswer As String
- Dim SumNum1 As Integer
- Dim SumNum2 As Integer
- Dim UnroundedAnswer As Decimal
- Dim BinOrHex As Integer
- Dim DenTo(1) As String
- Dim RandInteger As Integer
- Dim InputType As Boolean
- Dim Score As Integer = 0
- Public Function random1(ByRef BinNum As Integer)
- Randomize()
- BinNum = Int((Rnd()) * 2)
- Return BinNum
- End Function
- Public Function random2(ByRef HexOrDec As Integer)
- Randomize()
- HexOrDec = CInt(Math.Floor((1 - 0 + 1) * Rnd()))
- Return HexOrDec
- End Function
- Public Function random3(ByRef QType As Integer)
- Randomize()
- QType = CInt(Math.Floor((6 - 0 + 1) * Rnd()))
- Return QType
- End Function
- Public Function random4(ByRef BinOrHex As Integer)
- Randomize()
- BinOrHex = CInt(Math.Floor((1 - 0 + 1) * Rnd()))
- Return BinOrHex
- End Function
- Public Function random5(ByRef RandInteger As Integer)
- Randomize()
- RandInteger = CInt(Math.Floor((255 - 0 + 1) * Rnd()))
- Return RandInteger
- End Function
- Public Function random6(ByRef QType As Integer)
- Randomize()
- QType = CInt(Math.Floor((2 - 0 + 1) * Rnd()))
- Return QType
- End Function
- Public Function random7(ByRef QType As Integer)
- Randomize()
- QType = CInt(Math.Floor((5 - 0 + 1) * Rnd()))
- Return QType
- End Function
- Private Sub RichTextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles RichTextBox3.KeyPress
- If Not (Asc(e.KeyChar) = 8) Or (Asc(e.KeyChar) = 13) Then
- If Not ((Asc(e.KeyChar) >= 48 And Asc(e.KeyChar) <= 57) Or Asc(e.KeyChar) = 46 Or (Asc(e.KeyChar) >= 65 And Asc(e.KeyChar) <= 70) Or Asc(e.KeyChar) = 45) Then
- e.KeyChar = ChrW(0)
- e.Handled = True
- End If
- End If
- If (Asc(e.KeyChar) = 13) Then
- AnswerThing()
- End If
- End Sub
- Private Sub Questions(ByRef BinNum As Integer, ByRef HexOrDec As Integer, ByRef QType As Integer, ByRef BinaryStr As String, ByRef InputType As Boolean)
- RichTextBox2.SelectionAlignment = HorizontalAlignment.Center
- RichTextBox4.SelectionAlignment = HorizontalAlignment.Center
- RichTextBox5.SelectionAlignment = HorizontalAlignment.Center
- If CheckBox1.Checked = True Then
- QuestionType = random3(QType)
- Else
- QuestionType = random7(QType)
- End If
- QuestionType2 = random6(QType)
- If InputType = False Then
- If QuestionType = 0 Then
- BinTo(0) = "Denary?"
- BinTo(1) = "Hexadecimal?"
- Counter = 0
- RichTextBox2.Clear()
- RichTextBox2.AppendText("What is ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr = BinaryStr + BinNum.ToString
- Loop Until Counter = 8
- RichTextBox2.AppendText(" in ")
- random2(HexOrDec)
- OutputHexOrDec = BinTo(HexOrDec)
- RichTextBox2.AppendText(OutputHexOrDec)
- ElseIf QuestionType = 1 Then
- Counter = 0
- RichTextBox2.Clear()
- RichTextBox2.AppendText("What is ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr = BinaryStr + BinNum.ToString
- Loop Until Counter = 8
- Counter = 0
- RichTextBox2.AppendText(" + ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr2 = BinaryStr2 + BinNum.ToString
- Loop Until Counter = 8
- RichTextBox2.AppendText("?")
- ElseIf QuestionType = 2 Then
- Counter = 0
- RichTextBox2.Clear()
- RichTextBox2.AppendText("What is ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr = BinaryStr + BinNum.ToString
- Loop Until Counter = 8
- Counter = 0
- RichTextBox2.AppendText(" - ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr2 = BinaryStr2 + BinNum.ToString
- Loop Until Counter = 8
- RichTextBox2.AppendText("?")
- ElseIf QuestionType = 3 Then
- Counter = 0
- RichTextBox2.Clear()
- RichTextBox2.AppendText("What is ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr = BinaryStr + BinNum.ToString
- Loop Until Counter = 8
- Counter = 0
- RichTextBox2.AppendText(" x ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr2 = BinaryStr2 + BinNum.ToString
- Loop Until Counter = 8
- RichTextBox2.AppendText("?")
- ElseIf QuestionType = 4 Then
- Counter = 0
- RichTextBox2.Clear()
- TextBox1.Visible = True
- RichTextBox2.AppendText("What is ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr = BinaryStr + BinNum.ToString
- Loop Until Counter = 8
- Counter = 0
- RichTextBox2.AppendText(" / ")
- Do
- Counter = 0
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr2 = BinaryStr2 + BinNum.ToString
- Loop Until Counter = 8
- Loop Until BinaryStr2 <> "00000000"
- RichTextBox2.AppendText("?")
- ElseIf QuestionType = 5 Then
- DenTo(0) = "Binary?"
- DenTo(1) = "Hexadecimal?"
- Counter = 0
- RichTextBox2.Clear()
- RichTextBox2.AppendText("What is ")
- random5(RandInteger)
- RichTextBox2.AppendText(RandInteger & " in ")
- random4(BinOrHex)
- RichTextBox2.AppendText(DenTo(BinOrHex))
- ElseIf QuestionType = 6 Then
- Panel3.Visible = True
- Counter = 0
- RichTextBox2.Clear()
- RichTextBox2.Visible = False
- Do
- Panel3.Visible = True
- Mantissa1.Text = ""
- Mantissa2.Text = ""
- Mantissa3.Text = ""
- Mantissa4.Text = ""
- Mantissa5.Text = ""
- Mantissa6.Text = ""
- Mantissa7.Text = ""
- Mantissa8.Text = ""
- Exponent1.Text = ""
- Exponent2.Text = ""
- Exponent3.Text = ""
- Exponent4.Text = ""
- BinaryStr = ""
- Counter = 0
- Do
- random1(BinNum)
- Select Case Counter
- Case 0
- Mantissa1.Text = BinNum
- Case 1
- Mantissa2.Text = BinNum
- Case 2
- Mantissa3.Text = BinNum
- Case 3
- Mantissa4.Text = BinNum
- Case 4
- Mantissa5.Text = BinNum
- Case 5
- Mantissa6.Text = BinNum
- Case 6
- Mantissa7.Text = BinNum
- Case 7
- Mantissa8.Text = BinNum
- Case 8
- Exponent1.Text = BinNum
- Case 9
- Exponent2.Text = BinNum
- Case 10
- Exponent3.Text = BinNum
- Case 11
- Exponent4.Text = BinNum
- End Select
- Counter = Counter + 1
- BinaryStr = BinaryStr + BinNum.ToString
- Loop Until Counter = 16
- Loop Until BinaryStr.StartsWith("10") Or BinaryStr.StartsWith("01")
- End If
- ElseIf InputType = True Then
- If QuestionType2 = 0 Then
- Do
- BinaryStr = ""
- BinaryStr2 = ""
- Counter = 0
- RichTextBox2.Clear()
- RichTextBox2.AppendText("What is ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr = BinaryStr + BinNum.ToString
- Loop Until Counter = 8
- Counter = 0
- RichTextBox2.AppendText(" + ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr2 = BinaryStr2 + BinNum.ToString
- Loop Until Counter = 8
- RichTextBox2.AppendText("?")
- Answers(HexOrDec, BinaryStr, DecAnswer, OverallAnswer, HexAnswer, QuestionType, BinaryStr2, SumNum1, SumNum2, UnroundedAnswer, BinOrHex, BinaryStr5)
- Loop Until CarryBit = 0
- ElseIf QuestionType2 = 1 Then
- Do
- BinaryStr = ""
- BinaryStr2 = ""
- Counter = 0
- RichTextBox2.Clear()
- RichTextBox2.AppendText("What is ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr = BinaryStr + BinNum.ToString
- Loop Until Counter = 8
- Counter = 0
- RichTextBox2.AppendText(" - ")
- Do
- random1(BinNum)
- RichTextBox2.AppendText(BinNum)
- Counter = Counter + 1
- BinaryStr2 = BinaryStr2 + BinNum.ToString
- Loop Until Counter = 8
- RichTextBox2.AppendText("?")
- Loop Until Counter = 8
- ElseIf QuestionType2 = 2 Then
- Counter = 0
- BinOrHex = 0
- RichTextBox2.AppendText("What is ")
- random5(RandInteger)
- RichTextBox2.AppendText(RandInteger & " in Binary?")
- End If
- End If
- End Sub
- Public Function Answers(ByRef HexOrDec As Integer, ByRef BinaryStr As String, ByVal DecAnswer As Integer, ByVal OverallAnswer As String, ByVal HexAnswer As String, ByRef QuestionType As Integer, ByVal BinaryStr2 As String, ByVal SumNum1 As Integer, ByVal SumNum2 As Integer, ByVal UnroundedAnswer As Decimal, ByRef BinOrHex As Integer, ByVal BinaryStr5 As String)
- If InputType = False Then
- If QuestionType = 0 Then
- If HexOrDec = 0 Then
- If BinaryStr(0) = "1" Then
- DecAnswer += 128
- Else
- DecAnswer += 0
- End If
- If BinaryStr(1) = "1" Then
- DecAnswer += 64
- Else
- DecAnswer += 0
- End If
- If BinaryStr(2) = "1" Then
- DecAnswer += 32
- Else
- DecAnswer += 0
- End If
- If BinaryStr(3) = "1" Then
- DecAnswer += 16
- Else
- DecAnswer += 0
- End If
- If BinaryStr(4) = "1" Then
- DecAnswer += 8
- Else
- DecAnswer += 0
- End If
- If BinaryStr(5) = "1" Then
- DecAnswer += 4
- Else
- DecAnswer += 0
- End If
- If BinaryStr(6) = "1" Then
- DecAnswer += 2
- Else
- DecAnswer += 0
- End If
- If BinaryStr(7) = "1" Then
- DecAnswer += 1
- Else
- DecAnswer += 0
- End If
- OverallAnswer = DecAnswer.ToString
- ElseIf HexOrDec = 1 Then
- If BinaryStr(0) = "1" Then
- If BinaryStr(1) = "1" Then
- If BinaryStr(2) = "1" Then
- If BinaryStr(3) = "1" Then
- HexAnswer += "F"
- Else
- HexAnswer += "E"
- End If
- Else
- If BinaryStr(3) = "1" Then
- HexAnswer += "D"
- Else
- HexAnswer += "C"
- End If
- End If
- Else
- If BinaryStr(2) = "1" Then
- If BinaryStr(3) = "1" Then
- HexAnswer += "B"
- Else
- HexAnswer += "A"
- End If
- Else
- If BinaryStr(3) = "1" Then
- HexAnswer += "9"
- Else
- HexAnswer += "8"
- End If
- End If
- End If
- Else
- If BinaryStr(1) = "1" Then
- If BinaryStr(2) = "1" Then
- If BinaryStr(3) = "1" Then
- HexAnswer += "7"
- Else
- HexAnswer += "6"
- End If
- Else
- If BinaryStr(3) = "1" Then
- HexAnswer += "5"
- Else
- HexAnswer += "4"
- End If
- End If
- Else
- If BinaryStr(2) = "1" Then
- If BinaryStr(3) = "1" Then
- HexAnswer += "3"
- Else
- HexAnswer += "2"
- End If
- Else
- If BinaryStr(3) = "1" Then
- HexAnswer += "1"
- Else
- HexAnswer += "0"
- End If
- End If
- End If
- End If
- If BinaryStr(4) = "1" Then
- If BinaryStr(5) = "1" Then
- If BinaryStr(6) = "1" Then
- If BinaryStr(7) = "1" Then
- HexAnswer += "F"
- Else
- HexAnswer += "E"
- End If
- Else
- If BinaryStr(7) = "1" Then
- HexAnswer += "D"
- Else
- HexAnswer += "C"
- End If
- End If
- Else
- If BinaryStr(6) = "1" Then
- If BinaryStr(7) = "1" Then
- HexAnswer += "B"
- Else
- HexAnswer += "A"
- End If
- Else
- If BinaryStr(7) = "1" Then
- HexAnswer += "9"
- Else
- HexAnswer += "8"
- End If
- End If
- End If
- Else
- If BinaryStr(5) = "1" Then
- If BinaryStr(6) = "1" Then
- If BinaryStr(7) = "1" Then
- HexAnswer += "7"
- Else
- HexAnswer += "6"
- End If
- Else
- If BinaryStr(7) = "1" Then
- HexAnswer += "5"
- Else
- HexAnswer += "4"
- End If
- End If
- Else
- If BinaryStr(6) = "1" Then
- If BinaryStr(7) = "1" Then
- HexAnswer += "3"
- Else
- HexAnswer += "2"
- End If
- Else
- If BinaryStr(7) = "1" Then
- HexAnswer += "1"
- Else
- HexAnswer += "0"
- End If
- End If
- End If
- End If
- OverallAnswer = HexAnswer
- ElseIf HexOrDec = 2 Then
- Else
- RichTextBox2.AppendText("Error")
- End If
- ElseIf QuestionType = 1 Then
- If BinaryStr(0) = "1" Then
- SumNum1 += 128
- Else
- SumNum1 += 0
- End If
- If BinaryStr(1) = "1" Then
- SumNum1 += 64
- Else
- SumNum1 += 0
- End If
- If BinaryStr(2) = "1" Then
- SumNum1 += 32
- Else
- SumNum1 += 0
- End If
- If BinaryStr(3) = "1" Then
- SumNum1 += 16
- Else
- SumNum1 += 0
- End If
- If BinaryStr(4) = "1" Then
- SumNum1 += 8
- Else
- SumNum1 += 0
- End If
- If BinaryStr(5) = "1" Then
- SumNum1 += 4
- Else
- SumNum1 += 0
- End If
- If BinaryStr(6) = "1" Then
- SumNum1 += 2
- Else
- SumNum1 += 0
- End If
- If BinaryStr(7) = "1" Then
- SumNum1 += 1
- Else
- SumNum1 += 0
- End If
- If BinaryStr2(0) = "1" Then
- SumNum2 += 128
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(1) = "1" Then
- SumNum2 += 64
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(2) = "1" Then
- SumNum2 += 32
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(3) = "1" Then
- SumNum2 += 16
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(4) = "1" Then
- SumNum2 += 8
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(5) = "1" Then
- SumNum2 += 4
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(6) = "1" Then
- SumNum2 += 2
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(7) = "1" Then
- SumNum2 += 1
- Else
- SumNum2 += 0
- End If
- OverallAnswer = SumNum1 + SumNum2
- ElseIf QuestionType = 2 Then
- If BinaryStr(0) = "1" Then
- SumNum1 += 128
- Else
- SumNum1 += 0
- End If
- If BinaryStr(1) = "1" Then
- SumNum1 += 64
- Else
- SumNum1 += 0
- End If
- If BinaryStr(2) = "1" Then
- SumNum1 += 32
- Else
- SumNum1 += 0
- End If
- If BinaryStr(3) = "1" Then
- SumNum1 += 16
- Else
- SumNum1 += 0
- End If
- If BinaryStr(4) = "1" Then
- SumNum1 += 8
- Else
- SumNum1 += 0
- End If
- If BinaryStr(5) = "1" Then
- SumNum1 += 4
- Else
- SumNum1 += 0
- End If
- If BinaryStr(6) = "1" Then
- SumNum1 += 2
- Else
- SumNum1 += 0
- End If
- If BinaryStr(7) = "1" Then
- SumNum1 += 1
- Else
- SumNum1 += 0
- End If
- If BinaryStr2(0) = "1" Then
- SumNum2 += 128
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(1) = "1" Then
- SumNum2 += 64
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(2) = "1" Then
- SumNum2 += 32
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(3) = "1" Then
- SumNum2 += 16
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(4) = "1" Then
- SumNum2 += 8
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(5) = "1" Then
- SumNum2 += 4
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(6) = "1" Then
- SumNum2 += 2
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(7) = "1" Then
- SumNum2 += 1
- Else
- SumNum2 += 0
- End If
- OverallAnswer = SumNum1 - SumNum2
- ElseIf QuestionType = 3 Then
- If BinaryStr(0) = "1" Then
- SumNum1 += 128
- Else
- SumNum1 += 0
- End If
- If BinaryStr(1) = "1" Then
- SumNum1 += 64
- Else
- SumNum1 += 0
- End If
- If BinaryStr(2) = "1" Then
- SumNum1 += 32
- Else
- SumNum1 += 0
- End If
- If BinaryStr(3) = "1" Then
- SumNum1 += 16
- Else
- SumNum1 += 0
- End If
- If BinaryStr(4) = "1" Then
- SumNum1 += 8
- Else
- SumNum1 += 0
- End If
- If BinaryStr(5) = "1" Then
- SumNum1 += 4
- Else
- SumNum1 += 0
- End If
- If BinaryStr(6) = "1" Then
- SumNum1 += 2
- Else
- SumNum1 += 0
- End If
- If BinaryStr(7) = "1" Then
- SumNum1 += 1
- Else
- SumNum1 += 0
- End If
- If BinaryStr2(0) = "1" Then
- SumNum2 += 128
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(1) = "1" Then
- SumNum2 += 64
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(2) = "1" Then
- SumNum2 += 32
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(3) = "1" Then
- SumNum2 += 16
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(4) = "1" Then
- SumNum2 += 8
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(5) = "1" Then
- SumNum2 += 4
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(6) = "1" Then
- SumNum2 += 2
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(7) = "1" Then
- SumNum2 += 1
- Else
- SumNum2 += 0
- End If
- OverallAnswer = SumNum1 * SumNum2
- ElseIf QuestionType = 4 Then
- If BinaryStr(0) = "1" Then
- SumNum1 += 128
- Else
- SumNum1 += 0
- End If
- If BinaryStr(1) = "1" Then
- SumNum1 += 64
- Else
- SumNum1 += 0
- End If
- If BinaryStr(2) = "1" Then
- SumNum1 += 32
- Else
- SumNum1 += 0
- End If
- If BinaryStr(3) = "1" Then
- SumNum1 += 16
- Else
- SumNum1 += 0
- End If
- If BinaryStr(4) = "1" Then
- SumNum1 += 8
- Else
- SumNum1 += 0
- End If
- If BinaryStr(5) = "1" Then
- SumNum1 += 4
- Else
- SumNum1 += 0
- End If
- If BinaryStr(6) = "1" Then
- SumNum1 += 2
- Else
- SumNum1 += 0
- End If
- If BinaryStr(7) = "1" Then
- SumNum1 += 1
- Else
- SumNum1 += 0
- End If
- If BinaryStr2(0) = "1" Then
- SumNum2 += 128
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(1) = "1" Then
- SumNum2 += 64
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(2) = "1" Then
- SumNum2 += 32
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(3) = "1" Then
- SumNum2 += 16
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(4) = "1" Then
- SumNum2 += 8
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(5) = "1" Then
- SumNum2 += 4
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(6) = "1" Then
- SumNum2 += 2
- Else
- SumNum2 += 0
- End If
- If BinaryStr2(7) = "1" Then
- SumNum2 += 1
- Else
- SumNum2 += 0
- End If
- UnroundedAnswer = SumNum1 / SumNum2
- OverallAnswer = Math.Round(UnroundedAnswer, 2, MidpointRounding.AwayFromZero)
- ElseIf QuestionType = 5 Then
- If BinOrHex = 0 Then
- If RandInteger >= 128 Then
- BinaryStr += "1"
- RandInteger -= 128
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 64 Then
- BinaryStr += "1"
- RandInteger -= 64
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 32 Then
- BinaryStr += "1"
- RandInteger -= 32
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 16 Then
- BinaryStr += "1"
- RandInteger -= 16
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 8 Then
- BinaryStr += "1"
- RandInteger -= 8
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 4 Then
- BinaryStr += "1"
- RandInteger -= 4
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 2 Then
- BinaryStr += "1"
- RandInteger -= 2
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 1 Then
- BinaryStr += "1"
- RandInteger -= 1
- Else
- BinaryStr += "0"
- End If
- OverallAnswer = BinaryStr
- ElseIf BinOrHex = 1 Then
- If RandInteger >= 128 Then
- BinaryStr += "1"
- RandInteger -= 128
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 64 Then
- BinaryStr += "1"
- RandInteger -= 64
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 32 Then
- BinaryStr += "1"
- RandInteger -= 32
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 16 Then
- BinaryStr += "1"
- RandInteger -= 16
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 8 Then
- BinaryStr += "1"
- RandInteger -= 8
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 4 Then
- BinaryStr += "1"
- RandInteger -= 4
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 2 Then
- BinaryStr += "1"
- RandInteger -= 2
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 1 Then
- BinaryStr += "1"
- RandInteger -= 1
- Else
- BinaryStr += "0"
- End If
- If BinaryStr(0) = "1" Then
- If BinaryStr(1) = "1" Then
- If BinaryStr(2) = "1" Then
- If BinaryStr(3) = "1" Then
- HexAnswer += "F"
- Else
- HexAnswer += "E"
- End If
- Else
- If BinaryStr(3) = "1" Then
- HexAnswer += "D"
- Else
- HexAnswer += "C"
- End If
- End If
- Else
- If BinaryStr(2) = "1" Then
- If BinaryStr(3) = "1" Then
- HexAnswer += "B"
- Else
- HexAnswer += "A"
- End If
- Else
- If BinaryStr(3) = "1" Then
- HexAnswer += "9"
- Else
- HexAnswer += "8"
- End If
- End If
- End If
- Else
- If BinaryStr(1) = "1" Then
- If BinaryStr(2) = "1" Then
- If BinaryStr(3) = "1" Then
- HexAnswer += "7"
- Else
- HexAnswer += "6"
- End If
- Else
- If BinaryStr(3) = "1" Then
- HexAnswer += "5"
- Else
- HexAnswer += "4"
- End If
- End If
- Else
- If BinaryStr(2) = "1" Then
- If BinaryStr(3) = "1" Then
- HexAnswer += "3"
- Else
- HexAnswer += "2"
- End If
- Else
- If BinaryStr(3) = "1" Then
- HexAnswer += "1"
- Else
- HexAnswer += "0"
- End If
- End If
- End If
- End If
- If BinaryStr(4) = "1" Then
- If BinaryStr(5) = "1" Then
- If BinaryStr(6) = "1" Then
- If BinaryStr(7) = "1" Then
- HexAnswer += "F"
- Else
- HexAnswer += "E"
- End If
- Else
- If BinaryStr(7) = "1" Then
- HexAnswer += "D"
- Else
- HexAnswer += "C"
- End If
- End If
- Else
- If BinaryStr(6) = "1" Then
- If BinaryStr(7) = "1" Then
- HexAnswer += "B"
- Else
- HexAnswer += "A"
- End If
- Else
- If BinaryStr(7) = "1" Then
- HexAnswer += "9"
- Else
- HexAnswer += "8"
- End If
- End If
- End If
- Else
- If BinaryStr(5) = "1" Then
- If BinaryStr(6) = "1" Then
- If BinaryStr(7) = "1" Then
- HexAnswer += "7"
- Else
- HexAnswer += "6"
- End If
- Else
- If BinaryStr(7) = "1" Then
- HexAnswer += "5"
- Else
- HexAnswer += "4"
- End If
- End If
- Else
- If BinaryStr(6) = "1" Then
- If BinaryStr(7) = "1" Then
- HexAnswer += "3"
- Else
- HexAnswer += "2"
- End If
- Else
- If BinaryStr(7) = "1" Then
- HexAnswer += "1"
- Else
- HexAnswer += "0"
- End If
- End If
- End If
- End If
- OverallAnswer = HexAnswer
- End If
- ElseIf QuestionType = 6 Then
- End If
- ElseIf InputType = True Then
- If QuestionType2 = 0 Then
- CarryBit = 0
- If BinaryStr(7) = "0" And BinaryStr2(7) = "0" Then
- Bit8 = 0
- ElseIf BinaryStr(7) = "1" And BinaryStr2(7) = "0" Then
- Bit8 = 1
- ElseIf BinaryStr(7) = "0" And BinaryStr2(7) = "1" Then
- Bit8 = 1
- ElseIf BinaryStr(7) = "1" And BinaryStr2(7) = "1" Then
- Bit8 = 0
- CarryBit = 1
- End If
- If BinaryStr(6) = "0" And BinaryStr2(6) = "0" Then
- If CarryBit = 0 Then
- Bit7 = 0
- ElseIf CarryBit = 1 Then
- Bit7 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(6) = "1" And BinaryStr2(6) = "0" Then
- If CarryBit = 0 Then
- Bit7 = 1
- ElseIf CarryBit = 1 Then
- Bit7 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(6) = "0" And BinaryStr2(6) = "1" Then
- If CarryBit = 0 Then
- Bit7 = 1
- ElseIf CarryBit = 1 Then
- Bit7 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(6) = "1" And BinaryStr2(6) = "1" Then
- If CarryBit = 0 Then
- Bit7 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit7 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(5) = "0" And BinaryStr2(5) = "0" Then
- If CarryBit = 0 Then
- Bit6 = 0
- ElseIf CarryBit = 1 Then
- Bit6 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(5) = "1" And BinaryStr2(5) = "0" Then
- If CarryBit = 0 Then
- Bit6 = 1
- ElseIf CarryBit = 1 Then
- Bit6 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(5) = "0" And BinaryStr2(5) = "1" Then
- If CarryBit = 0 Then
- Bit6 = 1
- ElseIf CarryBit = 1 Then
- Bit6 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(5) = "1" And BinaryStr2(5) = "1" Then
- If CarryBit = 0 Then
- Bit6 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit6 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(4) = "0" And BinaryStr2(4) = "0" Then
- If CarryBit = 0 Then
- Bit5 = 0
- ElseIf CarryBit = 1 Then
- Bit5 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(4) = "1" And BinaryStr2(4) = "0" Then
- If CarryBit = 0 Then
- Bit5 = 1
- ElseIf CarryBit = 1 Then
- Bit5 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(4) = "0" And BinaryStr2(4) = "1" Then
- If CarryBit = 0 Then
- Bit5 = 1
- ElseIf CarryBit = 1 Then
- Bit5 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(4) = "1" And BinaryStr2(4) = "1" Then
- If CarryBit = 0 Then
- Bit5 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit5 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(3) = "0" And BinaryStr2(3) = "0" Then
- If CarryBit = 0 Then
- Bit4 = 0
- ElseIf CarryBit = 1 Then
- Bit4 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(3) = "1" And BinaryStr2(3) = "0" Then
- If CarryBit = 0 Then
- Bit4 = 1
- ElseIf CarryBit = 1 Then
- Bit4 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(3) = "0" And BinaryStr2(3) = "1" Then
- If CarryBit = 0 Then
- Bit4 = 1
- ElseIf CarryBit = 1 Then
- Bit4 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(3) = "1" And BinaryStr2(3) = "1" Then
- If CarryBit = 0 Then
- Bit4 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit4 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(2) = "0" And BinaryStr2(2) = "0" Then
- If CarryBit = 0 Then
- Bit3 = 0
- ElseIf CarryBit = 1 Then
- Bit3 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(2) = "1" And BinaryStr2(2) = "0" Then
- If CarryBit = 0 Then
- Bit3 = 1
- ElseIf CarryBit = 1 Then
- Bit3 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(2) = "0" And BinaryStr2(2) = "1" Then
- If CarryBit = 0 Then
- Bit3 = 1
- ElseIf CarryBit = 1 Then
- Bit3 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(2) = "1" And BinaryStr2(2) = "1" Then
- If CarryBit = 0 Then
- Bit3 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit3 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(1) = "0" And BinaryStr2(1) = "0" Then
- If CarryBit = 0 Then
- Bit2 = 0
- ElseIf CarryBit = 1 Then
- Bit2 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(1) = "1" And BinaryStr2(1) = "0" Then
- If CarryBit = 0 Then
- Bit2 = 1
- ElseIf CarryBit = 1 Then
- Bit2 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(1) = "0" And BinaryStr2(1) = "1" Then
- If CarryBit = 0 Then
- Bit2 = 1
- ElseIf CarryBit = 1 Then
- Bit2 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(1) = "1" And BinaryStr2(1) = "1" Then
- If CarryBit = 0 Then
- Bit2 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit2 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(0) = "0" And BinaryStr2(0) = "0" Then
- If CarryBit = 0 Then
- Bit1 = 0
- ElseIf CarryBit = 1 Then
- Bit1 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(0) = "1" And BinaryStr2(0) = "0" Then
- If CarryBit = 0 Then
- Bit1 = 1
- ElseIf CarryBit = 1 Then
- Bit1 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(0) = "0" And BinaryStr2(0) = "1" Then
- If CarryBit = 0 Then
- Bit1 = 1
- ElseIf CarryBit = 1 Then
- Bit1 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(0) = "1" And BinaryStr2(0) = "1" Then
- If CarryBit = 0 Then
- Bit1 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit1 = 1
- CarryBit = 1
- End If
- End If
- BinaryStr5 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- OverallAnswer = BinaryStr5
- ElseIf QuestionType2 = 1 Then
- If BinaryStr2(7) = "1" Then
- Bit8 = 1
- If BinaryStr2(6) = "0" Then
- Bit7 = 1
- ElseIf BinaryStr2(6) = "1" Then
- Bit7 = 0
- End If
- If BinaryStr2(5) = "0" Then
- Bit6 = 1
- ElseIf BinaryStr2(5) = "1" Then
- Bit6 = 0
- End If
- If BinaryStr2(4) = "0" Then
- Bit5 = 1
- ElseIf BinaryStr2(4) = "1" Then
- Bit5 = 0
- End If
- If BinaryStr2(3) = "0" Then
- Bit4 = 1
- ElseIf BinaryStr2(3) = "1" Then
- Bit4 = 0
- End If
- If BinaryStr2(2) = "0" Then
- Bit3 = 1
- ElseIf BinaryStr2(2) = "1" Then
- Bit3 = 0
- End If
- If BinaryStr2(1) = "0" Then
- Bit2 = 1
- ElseIf BinaryStr2(1) = "1" Then
- Bit2 = 0
- End If
- If BinaryStr2(0) = "0" Then
- Bit1 = 1
- ElseIf BinaryStr2(0) = "1" Then
- Bit1 = 0
- End If
- BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- ElseIf BinaryStr2(7) = "0" Then
- Bit8 = 0
- If BinaryStr2(6) = "1" Then
- Bit7 = 1
- If BinaryStr2(5) = "0" Then
- Bit6 = 1
- ElseIf BinaryStr2(5) = "1" Then
- Bit6 = 0
- End If
- If BinaryStr2(4) = "0" Then
- Bit5 = 1
- ElseIf BinaryStr2(4) = "1" Then
- Bit5 = 0
- End If
- If BinaryStr2(3) = "0" Then
- Bit4 = 1
- ElseIf BinaryStr2(3) = "1" Then
- Bit4 = 0
- End If
- If BinaryStr2(2) = "0" Then
- Bit3 = 1
- ElseIf BinaryStr2(2) = "1" Then
- Bit3 = 0
- End If
- If BinaryStr2(1) = "0" Then
- Bit2 = 1
- ElseIf BinaryStr2(1) = "1" Then
- Bit2 = 0
- End If
- If BinaryStr2(0) = "0" Then
- Bit1 = 1
- ElseIf BinaryStr2(0) = "1" Then
- Bit1 = 0
- End If
- BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- ElseIf BinaryStr2(6) = "0" Then
- Bit7 = 0
- If BinaryStr2(5) = "1" Then
- Bit6 = 1
- If BinaryStr2(4) = "0" Then
- Bit5 = 1
- ElseIf BinaryStr2(4) = "1" Then
- Bit5 = 0
- End If
- If BinaryStr2(3) = "0" Then
- Bit4 = 1
- ElseIf BinaryStr2(3) = "1" Then
- Bit4 = 0
- End If
- If BinaryStr2(2) = "0" Then
- Bit3 = 1
- ElseIf BinaryStr2(2) = "1" Then
- Bit3 = 0
- End If
- If BinaryStr2(1) = "0" Then
- Bit2 = 1
- ElseIf BinaryStr2(1) = "1" Then
- Bit2 = 0
- End If
- If BinaryStr2(0) = "0" Then
- Bit1 = 1
- ElseIf BinaryStr2(0) = "1" Then
- Bit1 = 0
- End If
- BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- ElseIf BinaryStr2(5) = "0" Then
- Bit6 = 0
- If BinaryStr2(4) = "1" Then
- Bit5 = 1
- If BinaryStr2(3) = "0" Then
- Bit4 = 1
- ElseIf BinaryStr2(3) = "1" Then
- Bit4 = 0
- End If
- If BinaryStr2(2) = "0" Then
- Bit3 = 1
- ElseIf BinaryStr2(2) = "1" Then
- Bit3 = 0
- End If
- If BinaryStr2(1) = "0" Then
- Bit2 = 1
- ElseIf BinaryStr2(1) = "1" Then
- Bit2 = 0
- End If
- If BinaryStr2(0) = "0" Then
- Bit1 = 1
- ElseIf BinaryStr2(0) = "1" Then
- Bit1 = 0
- End If
- BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- ElseIf BinaryStr2(4) = "0" Then
- Bit5 = 0
- If BinaryStr2(3) = "1" Then
- Bit4 = 1
- If BinaryStr2(2) = "0" Then
- Bit3 = 1
- ElseIf BinaryStr2(2) = "1" Then
- Bit3 = 0
- End If
- If BinaryStr2(1) = "0" Then
- Bit2 = 1
- ElseIf BinaryStr2(1) = "1" Then
- Bit2 = 0
- End If
- If BinaryStr2(0) = "0" Then
- Bit1 = 1
- ElseIf BinaryStr2(0) = "1" Then
- Bit1 = 0
- End If
- BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- ElseIf BinaryStr2(3) = "0" Then
- Bit4 = 0
- If BinaryStr2(2) = "1" Then
- Bit3 = 1
- If BinaryStr2(1) = "0" Then
- Bit2 = 1
- ElseIf BinaryStr2(1) = "1" Then
- Bit2 = 0
- End If
- If BinaryStr2(0) = "0" Then
- Bit1 = 1
- ElseIf BinaryStr2(0) = "1" Then
- Bit1 = 0
- End If
- BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- ElseIf BinaryStr2(2) = "0" Then
- Bit3 = 0
- If BinaryStr2(1) = "1" Then
- Bit2 = 1
- If BinaryStr2(0) = "0" Then
- Bit1 = 1
- ElseIf BinaryStr2(0) = "1" Then
- Bit1 = 0
- End If
- BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- ElseIf BinaryStr2(2) = "0" Then
- Bit2 = 0
- If BinaryStr2(1) = "1" Then
- Bit1 = 1
- BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- ElseIf BinaryStr2(2) = "0" Then
- Bit1 = 0
- BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- End If
- CarryBit = 0
- If BinaryStr(7) = "0" And BinaryStr6(7) = "0" Then
- Bit8 = 0
- ElseIf BinaryStr(7) = "1" And BinaryStr6(7) = "0" Then
- Bit8 = 1
- ElseIf BinaryStr(7) = "0" And BinaryStr6(7) = "1" Then
- Bit8 = 1
- ElseIf BinaryStr(7) = "1" And BinaryStr6(7) = "1" Then
- Bit8 = 0
- CarryBit = 1
- End If
- If BinaryStr(6) = "0" And BinaryStr6(6) = "0" Then
- If CarryBit = 0 Then
- Bit7 = 0
- ElseIf CarryBit = 1 Then
- Bit7 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(6) = "1" And BinaryStr6(6) = "0" Then
- If CarryBit = 0 Then
- Bit7 = 1
- ElseIf CarryBit = 1 Then
- Bit7 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(6) = "0" And BinaryStr6(6) = "1" Then
- If CarryBit = 0 Then
- Bit7 = 1
- ElseIf CarryBit = 1 Then
- Bit7 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(6) = "1" And BinaryStr6(6) = "1" Then
- If CarryBit = 0 Then
- Bit7 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit7 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(5) = "0" And BinaryStr6(5) = "0" Then
- If CarryBit = 0 Then
- Bit6 = 0
- ElseIf CarryBit = 1 Then
- Bit6 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(5) = "1" And BinaryStr6(5) = "0" Then
- If CarryBit = 0 Then
- Bit6 = 1
- ElseIf CarryBit = 1 Then
- Bit6 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(5) = "0" And BinaryStr6(5) = "1" Then
- If CarryBit = 0 Then
- Bit6 = 1
- ElseIf CarryBit = 1 Then
- Bit6 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(5) = "1" And BinaryStr6(5) = "1" Then
- If CarryBit = 0 Then
- Bit6 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit6 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(4) = "0" And BinaryStr6(4) = "0" Then
- If CarryBit = 0 Then
- Bit5 = 0
- ElseIf CarryBit = 1 Then
- Bit5 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(4) = "1" And BinaryStr6(4) = "0" Then
- If CarryBit = 0 Then
- Bit5 = 1
- ElseIf CarryBit = 1 Then
- Bit5 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(4) = "0" And BinaryStr6(4) = "1" Then
- If CarryBit = 0 Then
- Bit5 = 1
- ElseIf CarryBit = 1 Then
- Bit5 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(4) = "1" And BinaryStr6(4) = "1" Then
- If CarryBit = 0 Then
- Bit5 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit5 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(3) = "0" And BinaryStr6(3) = "0" Then
- If CarryBit = 0 Then
- Bit4 = 0
- ElseIf CarryBit = 1 Then
- Bit4 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(3) = "1" And BinaryStr6(3) = "0" Then
- If CarryBit = 0 Then
- Bit4 = 1
- ElseIf CarryBit = 1 Then
- Bit4 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(3) = "0" And BinaryStr6(3) = "1" Then
- If CarryBit = 0 Then
- Bit4 = 1
- ElseIf CarryBit = 1 Then
- Bit4 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(3) = "1" And BinaryStr6(3) = "1" Then
- If CarryBit = 0 Then
- Bit4 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit4 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(2) = "0" And BinaryStr6(2) = "0" Then
- If CarryBit = 0 Then
- Bit3 = 0
- ElseIf CarryBit = 1 Then
- Bit3 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(2) = "1" And BinaryStr6(2) = "0" Then
- If CarryBit = 0 Then
- Bit3 = 1
- ElseIf CarryBit = 1 Then
- Bit3 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(2) = "0" And BinaryStr6(2) = "1" Then
- If CarryBit = 0 Then
- Bit3 = 1
- ElseIf CarryBit = 1 Then
- Bit3 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(2) = "1" And BinaryStr6(2) = "1" Then
- If CarryBit = 0 Then
- Bit3 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit3 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(1) = "0" And BinaryStr6(1) = "0" Then
- If CarryBit = 0 Then
- Bit2 = 0
- ElseIf CarryBit = 1 Then
- Bit2 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(1) = "1" And BinaryStr6(1) = "0" Then
- If CarryBit = 0 Then
- Bit2 = 1
- ElseIf CarryBit = 1 Then
- Bit2 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(1) = "0" And BinaryStr6(1) = "1" Then
- If CarryBit = 0 Then
- Bit2 = 1
- ElseIf CarryBit = 1 Then
- Bit2 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(1) = "1" And BinaryStr6(1) = "1" Then
- If CarryBit = 0 Then
- Bit2 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit2 = 1
- CarryBit = 1
- End If
- End If
- If BinaryStr(0) = "0" And BinaryStr6(0) = "0" Then
- If CarryBit = 0 Then
- Bit1 = 0
- ElseIf CarryBit = 1 Then
- Bit1 = 1
- CarryBit = 0
- End If
- ElseIf BinaryStr(0) = "1" And BinaryStr6(0) = "0" Then
- If CarryBit = 0 Then
- Bit1 = 1
- ElseIf CarryBit = 1 Then
- Bit1 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(0) = "0" And BinaryStr6(0) = "1" Then
- If CarryBit = 0 Then
- Bit1 = 1
- ElseIf CarryBit = 1 Then
- Bit1 = 0
- CarryBit = 1
- End If
- ElseIf BinaryStr(0) = "1" And BinaryStr6(0) = "1" Then
- If CarryBit = 0 Then
- Bit1 = 0
- CarryBit = 1
- ElseIf CarryBit = 1 Then
- Bit1 = 1
- CarryBit = 1
- End If
- End If
- BinaryStr5 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
- OverallAnswer = BinaryStr5
- ElseIf QuestionType2 = 2 Then
- If BinOrHex = 0 Then
- If RandInteger >= 128 Then
- BinaryStr += "1"
- RandInteger -= 128
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 64 Then
- BinaryStr += "1"
- RandInteger -= 64
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 32 Then
- BinaryStr += "1"
- RandInteger -= 32
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 16 Then
- BinaryStr += "1"
- RandInteger -= 16
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 8 Then
- BinaryStr += "1"
- RandInteger -= 8
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 4 Then
- BinaryStr += "1"
- RandInteger -= 4
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 2 Then
- BinaryStr += "1"
- RandInteger -= 2
- Else
- BinaryStr += "0"
- End If
- If RandInteger >= 1 Then
- BinaryStr += "1"
- RandInteger -= 1
- Else
- BinaryStr += "0"
- End If
- OverallAnswer = BinaryStr
- Else
- OverallAnswer = "Error"
- End If
- End If
- End If
- Return OverallAnswer
- End Function
- Public Function AnswerCheck()
- If Counter2 = False Then
- RichTextBox4.AppendText(Answers(HexOrDec, BinaryStr, DecAnswer, OverallAnswer, HexAnswer, QuestionType, BinaryStr2, SumNum1, SumNum2, UnroundedAnswer, BinOrHex, BinaryStr5))
- Counter2 = True
- End If
- If InputType = False Then
- If RichTextBox3.Text = RichTextBox4.Text Then
- Return "Correct!"
- Else
- Return "Incorrect. Try again"
- End If
- ElseIf InputType = True Then
- If BinaryStr3 = RichTextBox4.Text Then
- Return "Correct!"
- Else
- Return "Incorrect. Try again"
- End If
- Else
- Return "Error"
- End If
- End Function
- Private Sub Label24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label24.Click
- AnswerThing()
- End Sub
- Public Sub AnswerThing()
- If Counter > 2 Then
- Counter = 0
- End If
- RichTextBox5.Clear()
- RichTextBox5.AppendText(AnswerCheck())
- If RichTextBox5.Text = "Incorrect. Try again" Then
- Counter += 1
- If Counter > 2 Then
- Label23.Visible = True
- End If
- ElseIf RichTextBox5.Text = "Correct!" Then
- If Counter3 = False Then
- Score += 1
- Label5.Text = Score
- Counter3 = True
- End If
- End If
- End Sub
- Private Sub Label12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label12.Click
- If InputType = True Then
- InputType = False
- RichTextBox3.SelectionAlignment = HorizontalAlignment.Center
- Panel1.Visible = False
- RichTextBox2.Visible = False
- RichTextBox4.Visible = False
- RichTextBox5.Visible = False
- Label23.Visible = False
- Label24.Visible = False
- ElseIf InputType = False Then
- InputType = True
- RichTextBox3.Visible = False
- RichTextBox2.Visible = False
- RichTextBox4.Visible = False
- RichTextBox5.Visible = False
- Label23.Visible = False
- Label24.Visible = False
- CheckBox1.Visible = False
- End If
- End Sub
- Private Sub Label23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label23.Click
- RichTextBox4.Visible = True
- Counter3 = True
- End Sub
- Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click
- Label24.Visible = True
- Label23.Visible = False
- RichTextBox2.Visible = True
- RichTextBox4.Visible = False
- RichTextBox5.Visible = True
- Panel2.Visible = True
- Label12.Visible = True
- CheckBox1.Visible = False
- Panel3.Visible = False
- TextBox1.Visible = False
- TextBox1.TextAlign = HorizontalAlignment.Center
- If InputType = True Then
- Panel1.Visible = True
- ElseIf InputType = False Then
- RichTextBox3.Visible = True
- CheckBox1.Visible = True
- End If
- RichTextBox2.Clear()
- RichTextBox3.Clear()
- RichTextBox4.Clear()
- RichTextBox5.Clear()
- Counter2 = False
- Counter3 = False
- BinaryStr = ""
- BinaryStr2 = ""
- BinaryStr5 = ""
- OverallAnswer = ""
- Questions(BinNum, HexOrDec, QType, BinaryStr, InputType)
- End Sub
- Private Sub lblTextSource3_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblTextSource3.MouseDown
- lblTextSource3.DoDragDrop(
- lblTextSource3.Text,
- DragDropEffects.Copy)
- End Sub
- Private Sub lblTextSource4_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblTextSource4.MouseDown
- lblTextSource4.DoDragDrop(
- lblTextSource4.Text,
- DragDropEffects.Copy)
- End Sub
- Private Sub lblTextTarget9_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget9.DragEnter
- If e.Data.GetDataPresent(DataFormats.Text) Then
- e.Effect = DragDropEffects.Copy
- Else
- e.Effect = DragDropEffects.None
- End If
- End Sub
- Private Sub lblTextTarget9_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget9.DragDrop
- lblTextTarget9.Text = e.Data.GetData(DataFormats.Text).ToString
- End Sub
- Private Sub lblTextTarget10_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget10.DragEnter
- If e.Data.GetDataPresent(DataFormats.Text) Then
- e.Effect = DragDropEffects.Copy
- Else
- e.Effect = DragDropEffects.None
- End If
- End Sub
- Private Sub lblTextTarget10_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget10.DragDrop
- lblTextTarget10.Text = e.Data.GetData(DataFormats.Text).ToString
- End Sub
- Private Sub lblTextTarget11_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget11.DragEnter
- If e.Data.GetDataPresent(DataFormats.Text) Then
- e.Effect = DragDropEffects.Copy
- Else
- e.Effect = DragDropEffects.None
- End If
- End Sub
- Private Sub lblTextTarget11_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget11.DragDrop
- lblTextTarget11.Text = e.Data.GetData(DataFormats.Text).ToString
- End Sub
- Private Sub lblTextTarget12_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget12.DragEnter
- If e.Data.GetDataPresent(DataFormats.Text) Then
- e.Effect = DragDropEffects.Copy
- Else
- e.Effect = DragDropEffects.None
- End If
- End Sub
- Private Sub lblTextTarget12_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget12.DragDrop
- lblTextTarget12.Text = e.Data.GetData(DataFormats.Text).ToString
- End Sub
- Private Sub lblTextTarget13_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget13.DragEnter
- If e.Data.GetDataPresent(DataFormats.Text) Then
- e.Effect = DragDropEffects.Copy
- Else
- e.Effect = DragDropEffects.None
- End If
- End Sub
- Private Sub lblTextTarget13_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget13.DragDrop
- lblTextTarget13.Text = e.Data.GetData(DataFormats.Text).ToString
- End Sub
- Private Sub lblTextTarget14_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget14.DragEnter
- If e.Data.GetDataPresent(DataFormats.Text) Then
- e.Effect = DragDropEffects.Copy
- Else
- e.Effect = DragDropEffects.None
- End If
- End Sub
- Private Sub lblTextTarget14_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget14.DragDrop
- lblTextTarget14.Text = e.Data.GetData(DataFormats.Text).ToString
- End Sub
- Private Sub lblTextTarget15_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget15.DragEnter
- If e.Data.GetDataPresent(DataFormats.Text) Then
- e.Effect = DragDropEffects.Copy
- Else
- e.Effect = DragDropEffects.None
- End If
- End Sub
- Private Sub lblTextTarget15_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget15.DragDrop
- lblTextTarget15.Text = e.Data.GetData(DataFormats.Text).ToString
- End Sub
- Private Sub lblTextTarget16_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget16.DragEnter
- If e.Data.GetDataPresent(DataFormats.Text) Then
- e.Effect = DragDropEffects.Copy
- Else
- e.Effect = DragDropEffects.None
- End If
- End Sub
- Private Sub lblTextTarget16_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget16.DragDrop
- lblTextTarget16.Text = e.Data.GetData(DataFormats.Text).ToString
- End Sub
- Private Sub BinarySet()
- Binary.Insert(0, lblTextTarget9.Text)
- Binary.Insert(1, lblTextTarget10.Text)
- Binary.Insert(2, lblTextTarget11.Text)
- Binary.Insert(3, lblTextTarget12.Text)
- Binary.Insert(4, lblTextTarget13.Text)
- Binary.Insert(5, lblTextTarget14.Text)
- Binary.Insert(6, lblTextTarget15.Text)
- Binary.Insert(7, lblTextTarget16.Text)
- End Sub
- Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
- If lblTextTarget9.Text <> "" Then
- RichTextBox1.AppendText(lblTextTarget9.Text)
- lblTextTarget9.Text = ""
- Else
- RichTextBox1.AppendText("0")
- lblTextTarget9.Text = ""
- End If
- If lblTextTarget10.Text <> "" Then
- RichTextBox1.AppendText(lblTextTarget10.Text)
- lblTextTarget10.Text = ""
- Else
- RichTextBox1.AppendText("0")
- lblTextTarget10.Text = ""
- End If
- If lblTextTarget11.Text <> "" Then
- RichTextBox1.AppendText(lblTextTarget11.Text)
- lblTextTarget11.Text = ""
- Else
- RichTextBox1.AppendText("0")
- lblTextTarget11.Text = ""
- End If
- If lblTextTarget12.Text <> "" Then
- RichTextBox1.AppendText(lblTextTarget12.Text)
- lblTextTarget12.Text = ""
- Else
- RichTextBox1.AppendText("0")
- lblTextTarget12.Text = ""
- End If
- If lblTextTarget13.Text <> "" Then
- RichTextBox1.AppendText(lblTextTarget13.Text)
- lblTextTarget13.Text = ""
- Else
- RichTextBox1.AppendText("0")
- lblTextTarget13.Text = ""
- End If
- If lblTextTarget14.Text <> "" Then
- RichTextBox1.AppendText(lblTextTarget14.Text)
- lblTextTarget14.Text = ""
- Else
- RichTextBox1.AppendText("0")
- lblTextTarget14.Text = ""
- End If
- If lblTextTarget15.Text <> "" Then
- RichTextBox1.AppendText(lblTextTarget15.Text)
- lblTextTarget15.Text = ""
- Else
- RichTextBox1.AppendText("0")
- lblTextTarget15.Text = ""
- End If
- If lblTextTarget16.Text <> "" Then
- RichTextBox1.AppendText(lblTextTarget16.Text)
- lblTextTarget16.Text = ""
- Else
- RichTextBox1.AppendText("0")
- lblTextTarget16.Text = ""
- End If
- BinaryLock(BinaryStr3, BinaryStr4, Counter)
- Label14.Text = BinaryStr3(0) & " " & BinaryStr3(1) & " " & BinaryStr3(2) & " " & BinaryStr3(3) & " " & BinaryStr3(4) & " " & BinaryStr3(5) & " " & BinaryStr3(6) & " " & BinaryStr3(7)
- End Sub
- Public Sub BinaryLock(ByRef BinaryStr3 As String, ByRef BinaryStr4 As String, ByRef Counter As Integer)
- BinaryStr3 = RichTextBox1.Text
- RichTextBox1.Clear()
- End Sub
- Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
- Label3.Visible = False
- Label2.Visible = False
- Label6.Visible = True
- InputType = True
- End Sub
- Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
- Label3.Visible = False
- Label2.Visible = False
- Label6.Visible = True
- InputType = False
- RichTextBox3.SelectionAlignment = HorizontalAlignment.Center
- End Sub
- Private Sub Label13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label13.Click
- End
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement