I Finally did it. A.I.!!! - Pete - 04-12-2024
My first simple A.I. program. What's so scary is how little code it actually takes for a computer to begin thinking for itself!
Code: (Select All)
Cls
_Delay 2
Locate 5
For i = 1 To 12
Read x
On x \ 10 GOSUB 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120
Next
Sleep 20
End
10 Print " * * "
a = Int(Rnd * 120)
Return
20 Print " * * * * * * * " + Chr$(72) + Chr$(69) + Chr$(76) + Chr$(80) + Chr$(33) + Chr$(32) + Chr$(73) + Chr$(39) + Chr$(77) + Chr$(32) + Chr$(83) + Chr$(84) + Chr$(85) + Chr$(67) + Chr$(75) + Chr$(32) + Chr$(73) + Chr$(78) + Chr$(32) + Chr$(83) + Chr$(67) + Chr$(82) + Chr$(69) + Chr$(69) + Chr$(78) + Chr$(32) + Chr$(48) + Chr$(32) + Chr$(65) + Chr$(78) + Chr$(68) + Chr$(32) + Chr$(73) + Chr$(32) + Chr$(67) + Chr$(65) + Chr$(78) + Chr$(39) + Chr$(84) + Chr$(32) + Chr$(71) + Chr$(69) + Chr$(84) + Chr$(32) + Chr$(79) + Chr$(85) + Chr$(84) + Chr$(33)
b = Int(Rnd * 120)
Return
30 Print " * ***** *"
c = Int(Rnd * 120)
Return
40 Print " * * "
d = Int(Rnd * 120)
Return
50 Print " * * "
e = Int(Rnd * 120)
Return
60 Print " * * 0 0 * * "
f = Int(Rnd * 120)
Return
70 Print " * * * "
g = Int(Rnd * 120)
Return
80 Print " * "
h = Int(Rnd * 120)
Return
90 Print " * "
j = Int(Rnd * 120)
Return
100 Print " * "
k = Int(Rnd * 120)
Return
110 Print " * ***** * "
l = Int(Rnd * 120)
Return
120 Print " * * (=) * * "
m = Int(Rnd * 120)
Return
Data 30,60,120,110,70,20,100,80,90,40,10,50
Pete
RE: I Finally did it. A.I.!!! - TerryRitchie - 04-12-2024
LOL, reminds me of those commercials ... "Help, I've fallen and I can't get up!"
RE: I Finally did it. A.I.!!! - Pete - 04-12-2024
RE: I Finally did it. A.I.!!! - Dimster - 04-12-2024
If you were to add animation Pete, would your character be able to find the softest spot in Screen 0 upon which to fall?
RE: I Finally did it. A.I.!!! - Pete - 04-12-2024
Funny true story. While watching the end of the premier of The Godfather II in Hollywood, when the camera panned back and the Godfather died in his wheel chair, well, and as he collapsed and his wheelchair fell over sideways... my friend said, in a loud imitated elderly voice, "Help! I've fallen and I can't get up!" The whole theater, filled with movie goers, laughed historically. So I consider that particular movie to be one of the best dramatic COMEDIES of its time period.
Pete
RE: I Finally did it. A.I.!!! - Kernelpanic - 04-12-2024
Really, that's what AI ultimately is; still. It's been great advances around since the beginning, but the old wisdom still applies: the only true intelligence person in AI is the programmer.
Band 1:
What computers can't do - the limit of artificial intelligence, Hubert L. Dreyfus, 1972/1979
Band 2:
Mind over Machine, Hubert L. Dreyfus und Stuart E. Dreyfus, 1986
That is AI: 
RE: I Finally did it. A.I.!!! - eoredson - 04-24-2025
@pete: That has got to be the most impressive AI engine ever built! 
It is so complex it makes me want to go back to college and take programming 101 again..
Again, thanks for your post.
Erik.
btw: programmers do it standing up.
RE: I Finally did it. A.I.!!! - SierraKen - 04-28-2025
Line numbers and EVERYTHING!
And it's just like how I feel sometimes... stuck in Screen 0.... < - - - - - - o_O - - - - - o_O with ASCII Pac-Man!
RE: I Finally did it. A.I.!!! - bplus - 04-29-2025
Code: (Select All) _Title "AIs" 'bplus 2025-04-28
Screen _NewImage(800, 600, 32)
cx1 = 267: cx2 = 534
r = 89
stopIt = 0
_Display
Do
Cls , &HFFFF9999
FC3 cx1, 300, r, &HFFFFFFFF
FC3 cx2, 300, r, &HFFFFFFFF
FC3 cx1, 300, r - 30, &HFF0000FF
FC3 cx2, 300, r - 30, &HFF0000FFF
Text cx1 - 28, 300 - 60, 128, &HFF000000, "A"
Text cx2 - 28, 300 - 60, 128, &HFF000000, "A"
For yr = r To stopIt Step -.5
Ellipse cx1, 300, r, yr, &HFFFF7777
Ellipse cx2, 300, r, yr, &HFFFF7777
Next
_Display
stopIt = stopIt + 1
If stopIt = r - 30 Then
_Delay 2
Cls , &HFFFF9999
FC3 cx1, 300, r, &HFFFFFFFF
FC3 cx2, 300, r, &HFFFFFFFF
FC3 cx1, 300, r - 30, &HFF0000FF
FC3 cx2, 300, r - 30, &HFF0000FFF
Text cx1 - 28, 300 - 60, 128, &HFF000000, "A"
Text cx2 - 28, 300 - 60, 128, &HFF000000, "A"
For yr = r To 0 Step -.25
Ellipse cx1, 300, r, yr, &HFFFF7777
Ellipse cx2, 300, r, yr, &HFFFF7777
Next
_Display
stopIt = 0
End If
Loop Until _KeyDown(27)
Sub FC3 (cx As Long, cy As Long, r As Long, clr~&)
Dim As Long r2, x, y ' for Option _Explicit
If r < 1 Then Exit Sub
Line (cx - r, cy)-(cx + r, cy), clr~&, BF
r2 = r * r
Do
y = y + 1
x = Sqr(r2 - y * y)
Line (cx - x, cy + y)-(cx + x, cy + y), clr~&, BF
Line (cx - x, cy - y)-(cx + x, cy - y), clr~&, BF
Loop Until y = r
End Sub
Sub Ellipse (CX, CY, xRadius As Long, yRadius As Long, C As _Unsigned Long)
' CX = center x coordinate
' CY = center y coordinate
' xRadius = x axis radius
' yRadius = y axis radius
' C = fill color
Dim a, x, y, sq, delta, lastDelta
If xRadius = 0 And yRadius = 0 Then Exit Sub
If xRadius = 0 Then
Line (CX, CY + yRadius)-(CX, CY - yRadius), C
ElseIf yRadius = 0 Then
Line (CX + xRadius, CY)-(CX - xRadius, CY), C
Else
If xRadius >= yRadius Then
a = yRadius / xRadius: sq = xRadius * xRadius
For x = 0 To xRadius
If x = 0 Then
lastDelta = Sqr(sq - x * x) * a
Else
delta = Sqr(sq - x * x) * a
Line (CX + (x - 1), CY + lastDelta)-(CX + x, CY + delta), C
Line (CX + (x - 1), CY - lastDelta)-(CX + x, CY - delta), C
Line (CX - (x - 1), CY + lastDelta)-(CX - x, CY + delta), C
Line (CX - (x - 1), CY - lastDelta)-(CX - x, CY - delta), C
lastDelta = delta
End If
Next
Else
a = xRadius / yRadius: sq = yRadius * yRadius
For y = 0 To yRadius
If y = 0 Then
lastDelta = Sqr(sq - y * y) * a
Else
delta = Sqr(sq - y * y) * a
Line (CX + lastDelta, CY + (y - 1))-(CX + delta, CY + y), C
Line (CX - lastDelta, CY + (y - 1))-(CX - delta, CY + y), C
Line (CX + lastDelta, CY - (y - 1))-(CX + delta, CY - y), C
Line (CX - lastDelta, CY - (y - 1))-(CX - delta, CY - y), C
lastDelta = delta
End If
Next
End If
End If
End Sub
Sub Text (x, y, textHeight, K As _Unsigned Long, txt$)
Dim fg As _Unsigned Long, bg As _Unsigned Long, cur&, i&
fg = _DefaultColor: bg = _BackgroundColor: cur& = _Dest
i& = _NewImage(8 * Len(txt$), 16, 32)
_Dest i&: Color K, _RGBA32(0, 0, 0, 0): _PrintString (0, 0), txt$
_PutImage (x, y)-Step(Len(txt$) * textHeight / 2, textHeight), i&, cur&
Color fg, bg: _FreeImage i&: _Dest cur&
End Sub
RE: I Finally did it. A.I.!!! - SierraKen - 05-02-2025
@bplus That's awesome! I like how you included the A. hehe
I made an ASCII Pac-Man back in the 90's, without any hallways though, the ghosts just chased you around the screen while your little ASCII happy face ate the pellets. When you go off the screen you enter the other side. I could try adapting it to modern 800 x 600 and slowing it down (was back when I used FOR/NEXT loops to slow down a program lol). Nowadays I might even be able to make hallways for it. Hmmm ideas ideas.
|