10-15-2003, 06:27 PM
years ago, I saw a documentary, on Sentient AI. Personally I believe its impossible to create sentiency on a computer, no matter how powerful. Since computers, by their very nature are little more than glorified "pachinko machines", though most say thats a stupid analogy.
Anyway, I started toying with the idea, of creating a program, that would learn and develop after reacting to certain stimuli.
In my example, getting the + makes him more likely to go after it, until thats all the charatcers does, and getting touched by X teaches him to avoid X
Its not real learning, but the illusion is fun.
Can you come up with a program that gives the genuine impression of learning? Im expecting anyone who does, to do better than my attempt, since Im no mathmatician or master at programming.
heck, maybe someone could even turn these into a kind of "sandbox" game, where by altering something, the "avatar" will react differently. I mean, what if you controlled X in my example, you could almost lead him around. Or perhaps youd both be after the "+"?
rules:
1) no libs, pure QB only
2) Aesthtics unimportant
3) no connecting to other programs etc.
4) no prescripted long movements, or demos, the AI must think on its own, based on surrounding stimulus and variables.
I knocked it up in about an hour and a half.
Feel free to mess around with it.
Anyway, I started toying with the idea, of creating a program, that would learn and develop after reacting to certain stimuli.
In my example, getting the + makes him more likely to go after it, until thats all the charatcers does, and getting touched by X teaches him to avoid X
Its not real learning, but the illusion is fun.
Can you come up with a program that gives the genuine impression of learning? Im expecting anyone who does, to do better than my attempt, since Im no mathmatician or master at programming.
heck, maybe someone could even turn these into a kind of "sandbox" game, where by altering something, the "avatar" will react differently. I mean, what if you controlled X in my example, you could almost lead him around. Or perhaps youd both be after the "+"?
rules:
1) no libs, pure QB only
2) Aesthtics unimportant
3) no connecting to other programs etc.
4) no prescripted long movements, or demos, the AI must think on its own, based on surrounding stimulus and variables.
Code:
'LEARNING AI
'This is a program to simulate learning and intelligence
'the smiley face needs to eat the "+"
'The X hunts the smiley face
'eating more food teaches him to go after food but makes him complacent about X
'getting attacked teaches him to avoid X but he frogets to eat
'feel free to tweak the AI and variables, or use this in making your own learning AI
RANDOMIZE TIMER
SCREEN 13
COLOR 7
INPUT "SUB LOOP WAIT = ", SP%
CLS
PRINT
PRINT
PRINT " ÃÃÃÃÃÃÃÃÃÃÃÃ"
PRINT " Ã Ã"
PRINT " Ã Ã"
PRINT " Ã Ã"
PRINT " Ã Ã"
PRINT " Ã Ã"
PRINT " Ã Ã"
PRINT " Ã Ã"
PRINT " Ã Ã"
PRINT " Ã Ã"
PRINT " Ã Ã"
PRINT " ÃÃÃÃÃÃÃÃÃÃÃÃ"
A = INT(RND * 10) + 4 'CHARACTER
B = INT(RND * 10) + 11
GA = INT(RND * 10) + 4 'GOOD
GB = INT(RND * 10) + 11
BA = INT(RND * 10) + 4 'BAD
BB = INT(RND * 10) + 11
GI = 10
BI = 10
DO
Q = Q + 1
IF Q > SP% THEN GOSUB MRV
LOCATE A, B
PRINT CHR$(1)
LOCATE GA, GB
PRINT "+"
LOCATE BA, BB
PRINT "X"
'LOCATE 1, 1
'PRINT "A="; A; "B="; B; "GA="; GA; "GB="; GB; "BA="; BA; "BB="; BB
LOCATE 18, 1
PRINT "GI="; CINT(GI); " "
LOCATE 19, 1
PRINT "BI="; CINT(BI); " "
LOCATE 16, 1
PRINT "SCORE:"; CINT(SC); " "
IF A = GA AND B = GB THEN 'WHAT HAPPENS IF TOUCH GOOD
SC = SC + 1
GI = GI - 1
IF GI < 2 THEN GI = 2
BI = BI + .5
IF B > 25 THEN BI = 25
LOCATE GA, GB
PRINT " "
GA = INT(RND * 10) + 4 'GOOD
GB = INT(RND * 10) + 11
SOUND 200, .5
END IF
IF A = BA AND B = BB THEN 'WHAT HAPPENS IF TOUCH BAD
SC = SC - 1.4
BI = BI - 1
IF BI < 1 THEN BI = 1
GI = GI + 1
IF GI > 10 THEN GI = 10
LOCATE BA, BB
PRINT " "
BA = INT(RND * 10) + 4 'BAD
BB = INT(RND * 10) + 11
SOUND 50, .5
END IF
IF SC <= -25 THEN GOTO FIN
IF SC >= 25 THEN GOTO FIN
LOOP UNTIL INKEY$ <> ""
END
MRV:
Q = 0
LOCATE A, B
PRINT " "
GG = INT(RND * GI) + 1 ' GOTO GOOD , BASED ON GOOD INTELIIGENCE
IF GG = 1 THEN
IF A < GA THEN A = A + 1
IF A > GA THEN A = A - 1
IF B < GB THEN B = B + 1
IF B > GB THEN B = B - 1
ELSEIF GG > 1 THEN
RM = INT(RND * 4) + 1
IF RM = 1 THEN A = A + 1
IF RM = 2 THEN A = A - 1
IF RM = 3 THEN B = B + 1
IF RM = 4 THEN B = B - 1
END IF
GGB = INT(RND * BI) + 1 ' AVOIDING BAD BASED ON BAD INTEL
IF GGB = 1 THEN
IF A > BA - 7 THEN A = A - 1
IF A < BA + 7 THEN A = A + 1
IF B > BB - 7 THEN B = B - 1
IF B < BB + 7 THEN B = B + 1
END IF
IF A >= 14 THEN A = 13 'WALL COLLISION
IF A <= 3 THEN A = 4
IF B >= 21 THEN B = 20
IF B <= 10 THEN B = 11
BTM = BTM + 1
IF BTM >= 4 THEN GOSUB BMRV 'BAD GUYS MOVES EVERY 2 SUB LOOPS
RETURN
BMRV:
BTM = 0 'ALL THIS IS BAD GUYS HUNTING
LOCATE BA, BB
PRINT " "
RM = INT(RND * 7) + 1
IF RM > 4 THEN
IF BA < A THEN BA = BA + 1
IF BA > A THEN BA = BA - 1
IF BB < B THEN BB = BB + 1
IF BB > B THEN BB = BB - 1
END IF
RM = INT(RND * 4) + 1
IF RM = 1 THEN BA = BA + 1
IF RM = 2 THEN BA = BA - 1
IF RM = 3 THEN BB = BB + 1
IF RM = 4 THEN BB = BB - 1
IF BA >= 14 THEN BA = 13 'BAD GUY WALL
IF BA <= 3 THEN BA = 4
IF BB >= 21 THEN BB = 20
IF BB <= 10 THEN BB = 11
RETURN
FIN:
IF SC <= -20 THEN PRINT "DEATH"
IF SC >= 20 THEN PRINT "EVOLUTION"
END
I knocked it up in about an hour and a half.
Feel free to mess around with it.