Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IMP - Not this old chestnut again
#13
I appreciate the IMP code, I have added it to my collection of IMP sample codes. By the way, do you recall this one?

Code: (Select All)
'IMP demo in multiple cases
Randomize Timer
_Title "IMProbable Demonstrations of the IMPossible Logic Operator named IMP..."
'demo  OutOfRange  InTheRange Lowest Uppest
Do
    n$ = UCase$(InKey$)
    If n$ = Chr$(27) Then End
    If n$ <> "" And InStr("OILU", n$) Then
        Cls
        For a = 1 To 10
            b = Int(Rnd * 40) + 1
            c = Int(Rnd * 30) + 2 + b
            d = Int(Rnd * 79) + 1
            Locate (a - 1) * 2 + 1, 1
            Print b; "  "; c; "  "; d; "  ";
            If n$ = "O" Then If outheRange(b, c, d) Then Print "out of range "; ' Else Print "in the range ";
            If n$ = "I" Then If intheRange(b, c, d) = -1 Then Print "In the range<---";
            If n$ = "L" Then If Lowest(b, c, d) Then Print "lowest  is "; d
            If n$ = "U" Then If Uppest(b, c, d) Then Print "Uppest  is "; d
            ' graphic rappresentation
            Color 2, 0: Locate (a - 1) * 2 + 2, b: Print ">";: Locate , c: Print "<";: Color 14, 0: Locate , d: Print "O";: Color 7, 0
        Next a
    End If
    Locate 23, 1: Print " Outherange Intherange Lowest Uppest, Escape to quit"
    Color 14, 0: Locate 23, 2: Print "O";: Locate 23, 13: Print "I";: Locate 23, 24: Print "L";: Locate 23, 31: Print "U";: Color 7, 0
    _Limit 10
Loop


' SUB and FUNCTION area  / area delle SUB e delle FUNCTION
Function outheRange (min As Integer, max As Integer, value As Integer)
    outheRange = 0
    outheRange = (min <= value Imp value >= max)
End Function

Function intheRange (min As Integer, max As Integer, value As Integer)
    intheRange = 0
    intheRange = (value <= max) Imp (value <= min)
    intheRange = Not intheRange
End Function

Function Lowest (a1%, a2%, T%)
    'NOT a OR b
    '3 8 1 -> F imp F = T
    '3 8 4 -> T imp F = F  no lowest
    '5 3 2 -> F imp T = T
    '6 4 9 -> T imp T = T  --> bug that it solves ordering a1% vs a2%
    If a1% > a2% Then Swap a1%, a2%
    Lowest = a1% < T% Imp a1% > a2%
End Function

Function Uppest (a1%, a2%, T%)
    'NOT a OR b
    '3 8 9 -> F imp T = T
    '3 2 6 -> F imp F = T
    '5 6 2 -> T imp T = T  -->bug  that it solves ordering a1% vs a2%
    '6 4 2 -> T imp F = F no uppest
    If a1% < a2% Then Swap a1%, a2%
    Uppest = a1% > T% Imp a1% < a2%
End Function
I get an error on the "Function intheRange" but love the Title of the program.

In terms of using AI, I'm afraid that train has left the station, we are going to be inundated with it.
Interesting you have mentioned Popper, it is his falsification theory that I find my computer understands the most ( ie A theory is Valid Until Proven False). Trouble is my computer is suggesting more of my theories are proven false than true. New Theory, I think my computer has a drinking problem.
Reply


Messages In This Thread
IMP - Not this old chestnut again - by Dimster - 10-16-2024, 02:57 PM
RE: IMP - Not this old chestnut again - by bplus - 10-16-2024, 04:01 PM
RE: IMP - Not this old chestnut again - by Pete - 10-16-2024, 10:25 PM
RE: IMP - Not this old chestnut again - by Dimster - 10-22-2024, 04:51 PM



Users browsing this thread: 3 Guest(s)