Action3.BAS
Software: Action3.BAS
'* Adaptron * 28 September 1998
'------------------
' (C) Copyright 1998, Brett N. Martensen
'
'Short Term memory with collapsing stimuli that are familiar
'Explicit Feelings - bored/reflex response if last two stimuli
'the same. Feelings of unfamiliarity are success!
'INPUT "DO YOU WANT SIMULTANEOUS PRINTER OUTPUT Y OR N";PRNT$
'IF PRNT$="y" THEN PRNT$="Y"
PRNT$="N"
OPEN "ADAPTRON.RUN" FOR OUTPUT AS #1
DA$= DATE$+" (mm-dd-yy) "+TIME$
PRINT DA$, " - Use Y for reward and N for punishment."
IF PRNT$="Y" THEN LPRINT " ADAPTRON RUN (Habits) of ";DA$
PRINT #1," ADAPTRON RUN (Habits) of ";DA$
DIM PRINTLINE$(35) 'LINES OF INPUT & OUTPUT
DIM STMATCH(20,30) 'doing/expected AND MATCH POSITIONS
DIM MEMORY$(300) 'LONG TERM MEMORY
DIM ATTENTION$(300) 'SOURCE OF STIMULUS
DIM FEELING$(300) 'FEELINGS EXPERIENCED
DIM RESPONSE$(300) 'RESPONSES MADE
DIM MATCHES(30) 'SUB-HABIT MATCHES IF EXECUTING
LEVEL=0 ' LEVEL OF CONCENTRATION
'0 = NONE, 1 = IDLE - JUST TRYING THE PAST EXPERIENCE
'2 = THINKING, 3 = REWARDED IN PAST.
STMPOS=0 ' CURRENT SHORT TERM MEMORY POSITION
' INCREMENT BEFORE STORING
STOREPOS=0 ' CURRENT LTM POSITION IN USE
STMSTART=0 ' START OF STM IN MEMORY
DOINGPOS=0 ' DOING FROM MEMORY POSITION
DOPOS=0 ' POSITION IN STM WHERE DOING
Pay.Attention:
' WHAT IS ATTENTION ATTRACTED TO MOST ?
'
' WHEN ENTERING HERE WE HAVE JUST RECIEVED INPUT, STORED IT,
' RECALLED IT, PRINTED RESULTS TO SCREEN
' If you are concentrating AT LEVEL 1 AND doing a past experience
' If its same as before - expected happens,
' HAVE SUCCESSFUL RECOGNITION/HABIT so COLLAPSE STM
' OR UNEXPECTED SO STOP DOING AND SKIP OVER TRIGGER STIMULUS
IF LEVEL > 0 THEN 'PERFORMING PAST EXPERIENCE
'DOES THE LAST ITEM MATCH ANY OF THE EXPECTED DOING ITEMS FROM
'MATCHES WITH TRIGGERING STIMULUS - i.e. match doing pos +1
' if so then have success
' collapse it, restore previous doing list and recall it
'else - produce sublist of doings/expected stimuli where
'just received stimulus matches triggering stimulus
'if list is empty - not expected (must be familiar by this time)
' then dump all previous STM to LTM and keep latest stimulus and
' its doing/expected list
'ELSE list >0 so WE HAVE FAMILIAR STIMULUS match one or more expected
' so do first one on list
IF FEELING$(STOREPOS)="EXPECTED" THEN 'MATCHED EXPERIENCE
'IF STIMULUS MATCHES EXPECTED RESULTING STIMULUS
' BUT NO RESPONSE DONE (JUST LISTENING) THEN
'WE HAVE RECOGNIZED A PAIR OF STIMULI - COLLAPSE THEM
'IF STIMULUS MATCHES EXPECTED RESULTING STIMULUS
' AND DID DO A RESPONSE THEN
' SUCCESS - WE WERE CONCENTRATING AND GOT SAME RESULTS
' CAN ESTABLISH A HABIT THAT REPEATS WHEN DONE
IF RECOGNIZED>0 THEN 'MATCH SUCCESSFUL
GOSUB RECOGNIZED 'COLLAPSE LAST TWO STIMULI
GOTO Pay.Attention 'CHECK OUT NEW STIMULUS/HABIT
ELSE
GOSUB SUBLEVEL 'CONTINUE RECOGNIZING/DOING
'SHOULD THEN DO FAMILIAR BELOW
END IF
ELSE 'FEELING IS FAMILIAR (BUT NOT EXPECTED),
' UNFAMILIAR OR BORED
GOSUB STOPIT 'stop concentrating and stop executing
END IF
END IF 'LEVEL > 0
'
' NOW REACT ACCORDING TO FEELINGS
'
IF FEELING$(STOREPOS)="EXPECTED" THEN 'DOING SUBLEVEL - ONLY EXPECTED &
'NOT EXPECTED CONTROLS EXECUTION
GOSUB FAMILIAR
ELSEIF FEELING$(STOREPOS)="FAMILIAR" THEN 'TRIGGER STIMULUS IS FAMILIAR
'IF DID LISTEN AND EXPECTED RESULTING STIMULUS FEELING
' = FAMILIAR
' OR = UNFAMILIAR THEN
' DO IT AGAIN (LEVEL 1) TO TRY AND RECOGNIZE IT
'IF DID RESPONSE AND EXP. RESULT. STIM. FEELING
' = FAMILIAR
' DONT DO SAME RESPONSE BECAUSE SAME THING SHOULD HAPPEN
' UNLESS LEVEL>0
'
' OR = UNFAMILIAR
' DO IT AGAIN SEE IF IT REOCCURS AT WHICH POINT IT WILL
' BE FAMILIAR AND WE WILL TRY SOMETHING ELSE THE
' NEXT TIME
IF RESPONSE$(STMATCH(STMPOS,1))="LISTEN" THEN
GOSUB FAMILIAR 'DO AT MATCH POSITION
ELSE 'PREVIOUS DID RESPONSE
IF FEELING$(STMATCH(STMPOS,1)+1)="UNFAMILIAR" OR LEVEL>0 THEN
GOSUB FAMILIAR
ELSE 'PAST EXPERIENCE GAVE FAMILIAR FEELING
RESPONSE$(STOREPOS)="LISTEN" 'WILL DO LISTEN BELOW
END IF
END IF
ELSEIF FEELING$(STOREPOS)="BORED" THEN 'REFLEXIVE OUTPUT
GOSUB STOPIT
STMPOS=0 'CLEAR OUT BORING STIMULUS FROM STM
GOSUB REFLEX
ELSEIF FEELING$(STOREPOS)="UNFAMILIAR" THEN 'ORIENTING RESPONSE
GOSUB UNFAMILIAR 'EMPTY STM AND DEFAULT LISTEN
END IF
' WHEN THERE ARE NO FEELINGS TO USE PAY ATTENTION TO INPUT
' IF RESPONSE DONE THEN INPUT THE STIMULUS RESULT OF RESPONSE
' IF OUTPUT$<>"" THEN
' GOSUB ECHO 'RECEIVE RESPONSES KINEASTHETHIC INPUT
' ELSE
GOSUB Listen
' END IF
GOTO Pay.Attention 'Pay attention to what ever came in.
'''''''''''''''''''''EXECUTING PREVIOUS EXPERIENCES''''''''''''''''''
'
' DOING AT LEVEL OF CONCENTRATION
' DO RESPONSE (IF ANY) FROM MATCHING POSITION
' FOLLOWED BY ATTENTION TO NEXT STIMULUS ADDRESS
DOING:
DOINGPOS = STMATCH(DOPOS,1) 'LOCATION OF MATCH IN PAST
OUTPUT$="" 'LOWERCASE LETTER IF RESPONSE MADE
LEVEL=1 'DEFAULT LEVEL OF CONCENTRATION
' PRINT "doing at ";DOINGPOS; "cont.."; : input a$
'POSSIBLE TO DO'S -
'U - UNFAMILIAR = ORIENT RESPONSE - LISTEN
'F - FAMILIAR = START DOING
'E - EXPECTED - SUCCESS/SAME = DO SUB-HABIT
' - POTENTIAL SAME= CONTINUE DOING
'lowercase letter - OUTPUT IT
' JUST FINISHED RECOGNIZING THIS STIMULUS OR HABIT SO NOW DO WHAT DID LAST
' TIME THIS WAS EXPERIENCED DON'T DECOMPOSE HABIT.
' IF ATTENTION$(DOINGPOS)="HABIT" THEN
' 'WHEN DOING HABIT DO AT SUB HABIT
' WHILE ATTENTION$(DOINGPOS)="HABIT"
' DOINGPOS=ASC(MEMORY$(DOINGPOS))
' WEND
' ELSE
IF RESPONSE$(DOINGPOS)="LISTEN" THEN
RESPONSE$(STOREPOS)="LISTEN" 'DEFAULT LISTEN
ELSE
GOSUB Respond 'DO OUTPUT
END IF
RETURN
RECOGNIZED: 'SUCCESSFUL RECOGNITION OF PAIR SO IT BECOMES A HABIT
' PRINT "RECOGNIZED"
'so can collapse pair and give IT A position id
STMPOS=STMPOS-2 'last 2 entries collapse (RECALL WILL +1 IT)
STOREPOS=STOREPOS-1
MEMORY$(STOREPOS)=CHR$(STMATCH(DOPOS,RECOGNIZED))
ATTENTION$(STOREPOS)="HABIT"
FEELING$(STOREPOS)=""
RESPONSE$(STOREPOS)=""
DOPOS=DOPOS-1 'DOING OF PREVIOUS TRIGGER STIMULUS
'NOW RECALL THIS AND SEE IF IT MATCHES
GOSUB RECALL 'REMEMBER the HABIT and do the recall
RETURN
SUBLEVEL: 'RECOGNITION AT SUB HABIT LEVEL SO STORE SUB MATCH LIST
' PRINT "SUBLEVEL"
FOR JJ=0 TO MATCHES(0) ' REASSIGN STMATCH LIST
STMATCH(STMPOS,JJ)=MATCHES(JJ)
NEXT JJ
'LIST OF MATCHES IN STMATCH SO DO THE FIRST
RETURN
STOPIT: 'WAS DOING = EXPECTING BUT NO MATCH FOUND SO
'STOP CONCENTRATING AND STOP DOING, STORE TRIGGER STIMULI
' PRINT "STOPIT"
LEVEL = 0 'NOT CONCENTRATING
DOPOS=0 'NOT DOING
STMSTART=STOREPOS-1 'ADVANCE STM TO ONLY BE THIS LATEST STIMULUS
FOR II=0 TO STMATCH(STMPOS,0)
STMATCH(1,II)=STMATCH(STMPOS,II)
NEXT II
STMPOS=1 'JUST LATEST STIMULUS IN STM
RETURN
'FAMILIAR STIMULUS RECEIVED - SO:
' START DOING - CONCENTRATION LEVEL 1
' MOST RECENT MATCH
FAMILIAR:
' PRINT "FAMILIAR"
'KEEP THE MATCH POSITIONS FOR THE TRIGGER STIMULUS IN STM
'IS FOLLOWED BY EXPECTED NEXT STIMULUS / RESPONSE
DOPOS=STMPOS 'DOING LIST OF MATCHES
GOSUB DOING 'GO GET EXPECTED NEXT ITEM
RETURN 'DO WHATEVER WAS DONE PREVIOUSLY
'UNFAMILIAR STIMULUS RECEIVED - SO:
' FLUSH STM TO LTM
UNFAMILIAR:
' PRINT "UNFAMILIAR"
RESPONSE$(STOREPOS)="LISTEN"
STMSTART=STOREPOS
STMPOS=0 'NO CURRENT STM MATCHES
RETURN 'PAY ATTENTION TO INPUT
'''''''''''''''''''''''''INPUT / OUTPUT '''''''''''''''''''''''''''''''''
'
' LISTEN FOR INPUT - Obtain stimulus from real world
'
Listen:
L$=RIGHT$(" "+STR$(STOREPOS+1),3)
PRINTLINE$(LIN)= L$+" DOPOS="+STR$(DOPOS)+" LVL="+STR$(LEVEL)+" DO @ "
FOR I=1 TO STMATCH(DOPOS,0)
IF STMATCH(DOPOS,I)>9 THEN
P$=P$+RIGHT$(STR$(STMATCH(DOPOS,I)),3)
ELSE
P$=P$+RIGHT$(STR$(STMATCH(DOPOS,I)),2)
END IF
NEXT I
P$=LEFT$(P$+SPACE$(20),20)
PRINTLINE$(LIN)=PRINTLINE$(LIN)+P$
P$=""
PRINT PRINTLINE$(LIN);
INPUT " INPUT "; INPU$
IF INPU$="?" THEN GOSUB DUMPSTM : GOTO LISTEN
PRINTLINE$(LIN)=PRINTLINE$(LIN)+" INPUT ? "+INPU$
LIN=LIN+1 : IDOWN=IDOWN+1
IF PRNT$="Y" THEN LPRINT "INPUT> "; INPU$; 'TO PRINTER
PRINT #1,PRINTLINE$(LIN-1) 'TO DISK
LISTEN2:
STOREPOS=STOREPOS+1
MEMORY$(STOREPOS)=INPU$
ATTENTION$(STOREPOS)="INPUT"
FEELING$(STOREPOS)=""
RESPONSE$(STOREPOS)=""
GOSUB RECALL 'RECALL the INPUT
RETURN
'KINEASTHETIC INPUT FROM RESPONSE
ECHO:
INPU$=OUTPUT$
OUTPUT$=""
GOTO LISTEN2
'
' MOTOR - OUTPUT - Perform real world response
'
Respond:
OUTTYPE$="-" 'NON-REFLEXIVE INDICATOR
RESPONSE$(STOREPOS)=RESPONSE$(DOINGPOS)
OUTPUT$=RESPONSE$(STOREPOS) 'TESTED FOR RESPONSE MADE
RESPOND2:
L$=RIGHT$(" "+STR$(STOREPOS),3)
PRINTLINE$(LIN)=L$+" DOPOS="+STR$(DOPOS)+" LVL="+STR$(LEVEL)+" DO @ "
FOR I=1 TO STMATCH(DOPOS,0)
IF STMATCH(DOPOS,I)>9 THEN
P$=P$+RIGHT$(STR$(STMATCH(DOPOS,I)),3)
ELSE
P$=P$+RIGHT$(STR$(STMATCH(DOPOS,I)),2)
END IF
NEXT I
P$=LEFT$(P$+SPACE$(21),21)
PRINTLINE$(LIN)=PRINTLINE$(LIN)+P$
P$=""
'PRINT " OUT "+OUTTYPE$+"> ";RESPONSE$(STOREPOS)
PRINTLINE$(LIN)=PRINTLINE$(LIN)+" OUT "+OUTTYPE$+"> "+RESPONSE$(STOREPOS)
PRINT PRINTLINE$(LIN);
LIN=LIN+1 : IDOWN=IDOWN+1
IF PRNT$="Y" THEN LPRINT "OUT "+OUTTYPE$+"> ";RESPONSE$(STOREPOS)
PRINT #1,PRINTLINE$(LIN-1) 'TO DISK
'SHORTEN LIST OF MATCHING STIMULI TO JUST THOSE THAT DID THIS RESPONSE
'THIS IS THE LIST OF STIMULI/RESPONSES PERFORMED
NUMATCHES=0
FOR I=1 TO STMATCH(DOPOS,0)
IF RESPONSE$(STMATCH(DOPOS,I))=RESPONSE$(STOREPOS) THEN
NUMATCHES=NUMATCHES+1
STMATCH(DOPOS,NUMATCHES)=STMATCH(DOPOS,I)
END IF
NEXT I
STMATCH(DOPOS,0)=NUMATCHES
RETURN
'GENERATE reflexive OUTPUT
REFLEX:
'OUTPUT LOWERCASE LETTER
OUTPUT$=CHR$(INT(2*RND(5))+97) 'Random output 2 POSSIBLES
IF OUTPUT$=LASTOUTPUT$ THEN GOTO REFLEX 'NEVER SAME TWICE IN ROW
LASTOUTPUT$=OUTPUT$
' J=INT(5*RND(5))+1
' SELECT CASE J
' CASE 1 : ASSOCOUTPUT$="BARK"
' CASE 2 : ASSOCOUTPUT$="EAT"
' CASE 3 : ASSOCOUTPUT$="PANT"
' CASE 4 : ASSOCOUTPUT$="LICK"
' CASE 5 : ASSOCOUTPUT$="LOOK"
' END SELECT
RESPONSE$(STOREPOS)=OUTPUT$
OUTTYPE$="R"
GOSUB RESPOND2
RETURN
''''''''''''''''''''''''''' RECALL / FEELINGS ''''''''''''''''''''''''''''''
' Actual order is
' recall THEN
' determine feelings and IF EXPECTED
RECALL:
' IF ATTENTION$(STOREPOS)="INPUT" THEN
' IF MEMORY$(STOREPOS)="Y" THEN
' FEELNG$="GOOD"
' ELSEIF MEMORY$(STOREPOS)="N" THEN
' FEELNG$="BAD "
' END IF
' END IF
GOSUB RECALLIT ' RECALL ANY ASSOCIATED INFO
IF NUMATCHES=0 THEN
FEELING$(STOREPOS)="UNFAMILIAR" 'novel / unfamiliar
ELSE
FEELING$(STOREPOS)="FAMILIAR" 'familiar / EXPERIENCED BEFORE
IF STMATCH(STMPOS,1)=STOREPOS-1 THEN 'BORED
FEELING$(STOREPOS)="BORED"
END IF
'IF FAMILIAR DOES IT MATCHES ANY EXPECTED INPUT
IF LEVEL > 0 THEN 'PERFORMING PAST EXPERIENCE
'DOES THE LAST ITEM MATCH ANY OF THE EXPECTED DOING ITEMS FROM
'MATCHES WITH TRIGGERING STIMULUS - i.e. match doing pos +1
' if so then have success - EXPECTED=YES
' else - produce sublist of doings/expected stimuli where
'just received stimulus matches triggering stimulus
'if list is empty - not expected (must be familiar by this time)
'ELSE list >0 so WE HAVE FAMILIAR STIMULUS match one or more expected
' so do first one on list
LIMITA=STMATCH(STMPOS,0) 'number of matches FOR INPUT stimulus
LIMITE=STMATCH(DOPOS,0) 'NUMBER OF DOINGS/EXPECTATIONS
RECOGNIZED=0 'SET IF SUCCESSFUL RECOGNITION
'IF LIMITA=0 LOOP NOT DONE!
FOR JJ=1 TO LIMITA 'FOR EACH PAST STIMULUS MATCHED
'IF LIMITE=0 LOOP NOT DONE!
FOR II=1 TO LIMITE 'FOR EACH POSSIBLE EXPECTATION
'ARE ANY EQUIVALENT
IF STMATCH(STMPOS,JJ)=STMATCH(DOPOS,II)+1 THEN
'SO HAVE SUCCESSFUL MATCH OF EXPECTATION
FEELING$(STOREPOS)="EXPECTED"
RECOGNIZED=II 'THE RECOGNIZED ONE
' PRINT "EXPECTED AT";RECOGNIZED;
'The same thing happened as last time! - SUCCESS
II=LIMITE+1
JJ=LIMITA+2 'EXIT LOOP
END IF
NEXT II
NEXT JJ
'NOT AN EXACT EXPECTED MATCH BUT MIGHT BE A SUB-HABIT MATCH
IF FEELING$(STOREPOS)<>"EXPECTED" THEN
MATCHES(0)=0 'LIST OF MATCHING HABIT'S EMPTY
'IF LIMIT=0 LOOP NOT DONE!
FOR II=1 TO STMATCH(DOPOS,0) 'FOR EACH POSSIBLE EXPECTATION
'expected might be HABIT/high level stimulus so find actual
POSITION=STMATCH(DOPOS,II)+1 'POSITION OF EXPECTED
EXPECT$=ATTENTION$(POSITION) 'INPUT OR HABIT
WHILE EXPECT$="HABIT"
POSITION=ASC(MEMORY$(POSITION))
EXPECT$=ATTENTION$(POSITION) 'INPUT OR HABIT
'IF LIMIT=0 LOOP NOT DONE!
FOR JJ= 1 TO STMATCH(STMPOS,0)
IF POSITION = STMATCH(STMPOS,JJ) THEN
FEELING$(STOREPOS)="EXPECTED"
' The same thing happened as last time! ADD TO MATCH LIST
MATCHES(0)=MATCHES(0)+1
MATCHES(MATCHES(0))=POSITION
END IF
NEXT JJ
WEND
NEXT II
END IF
END IF 'IF LEVEL > 0
END IF 'IF FAMILIAR
' print the results of recall
GOSUB DUMPLTM
RETURN
''''''''''''''''''''''''''''''''''RECALLIT''''''''''''''''''''''''''
' The thing to recall is in MEMORY$(STOREPOS) and ATTENTION$(STOREPOS),
' it has been stored AT THE END OF MEMORY
RECALLIT:
' FIRST FIND ALL THE LOCATIONS IN LTM WHERE THE STIMULUS OCCURRED AND
' LIST will be ordered BY RECENCY. THEN USE THIS LIST.
GOSUB MATCH 'FIND MATCHING LOCATIONS
STMATCH(STMPOS,0)=NUMATCHES 'NUMBER OF MATCHES
RETURN
'PATTERN MATCH SEARCH
MATCH:
' Go backward through memory looking for matches
STMPOS=STMPOS+1 'INCREMENT TO NEXT AVAILABLE LOCATION
NUMATCHES=0 'NO MATCHES YET
BACKPOS=STOREPOS 'Start at the latest memory AND
3000 BACKPOS=BACKPOS-1 'go backwards in memory
IF BACKPOS<1 THEN RETURN 'If at start of memory then done
'HAVE LIST OF MATCHES IN RECENCY ORDER
IF MEMORY$(BACKPOS) <> MEMORY$(STOREPOS) OR_
ATTENTION$(BACKPOS) <> ATTENTION$(STOREPOS) THEN GOTO 3000 'LOOKING FOR A MATCH
NUMATCHES=NUMATCHES+1
STMATCH(STMPOS,NUMATCHES)=BACKPOS 'RECORD MATCH POSITION
GOTO 3000
'----------------------- MONITORING --------------------------------------
'
' DUMP STM TO SCREEN
'
DUMPSTM:
MAX=0 'SHORT TERM MEMORY
FOR J=0 TO 30
FOR I=1 TO STMPOS
PRINT RIGHT$(" "+STR$(STMATCH(I,J)),3);
IF J=0 AND MAX<STMATCH(I,J) THEN MAX=STMATCH(I,J)
NEXT I
PRINT
IF J=MAX THEN J=31
NEXT J
RETURN
'
' PRINTING LONG TERM MEMORY
'
DUMPLTM:
' PRINT INFO ONTO TOP PART OF SCREEN
CLS
PRINT " MATCH @ "; 'MATCHING EXPERIENCES
FOR I=1 TO STMATCH(STMPOS,0)
IF STMATCH(STMPOS,I)>9 THEN
PRINT RIGHT$(STR$(STMATCH(STMPOS,I)),3);
ELSE
PRINT RIGHT$(STR$(STMATCH(STMPOS,I)),2);
END IF
NEXT I
PRINT
PRINT
print "M "; 'MEMORY LOCATION
FOR I=1 TO STOREPOS
IF I>9 THEN
PRINT RIGHT$(STR$(I),3);
ELSE
PRINT RIGHT$(STR$(I),2);
END IF
NEXT I
PRINT
' print "S "; 'ATTENTION / SENSE
' FOR I=1 TO STOREPOS
' IF I>9 THEN
' PRINT " "+LEFT$(ATTENTION$(I),1);
' ELSE
' PRINT " "+LEFT$(ATTENTION$(I),1);
' END IF
' NEXT I
' PRINT
print "I "; 'PAST STIMULI
FOR I=1 TO STOREPOS
IF I>9 THEN
J=3
ELSE
J=2
END IF
IF ATTENTION$(I)="HABIT" THEN
PRINT RIGHT$(" "+STR$(ASC(MEMORY$(I))),J);
ELSE
SP=J-LEN(MEMORY$(I))
IF SP<0 THEN SP=0
PRINT LEFT$(" ",SP)+LEFT$(MEMORY$(I),J-SP);
END IF
NEXT I
PRINT
print "F "; 'PAST FEELINGS
FOR I=1 TO STOREPOS
IF I>9 THEN
PRINT " "+LEFT$(FEELING$(I),2);
ELSE
PRINT " "+LEFT$(FEELING$(I),1);
END IF
NEXT I
PRINT
print "O "; 'PAST RESPONSES
FOR I=1 TO STOREPOS
IF I>9 THEN
PRINT " "LEFT$(RESPONSE$(I),1);
ELSE
PRINT " "+LEFT$(RESPONSE$(I),1);
END IF
NEXT I
PRINT
PRINT
'PRINT THE INPUT / OUTPUT HISTORY
FOR I= 0 TO LIN-1
PRINT PRINTLINE$(I)
IF LIN>28 THEN 'SHIFT IT ALL DOWN
PRINTLINE$(I)=PRINTLINE$(I+IDOWN)
END IF
NEXT I
IF LIN>28 THEN LIN=LIN-IDOWN
IDOWN=0
' PRINT INFO TO FILE
' DOPOS$=RIGHT$(" "+STR$(DOPOS),4)
' IF SENSE$="OUTID" OR SENSE$="INPID" OR SENSE$="FEELI"_
' THEN PRINT #1," ";
' PRINT #1," @";STOREPOS;SENSE$;",";SCANPRINT$;" LEVEL=";LEVEL;"DOING AT";DOPOS$;"-->";
' PRINT #1,""
' 'PRINT INFO ON PRINTER
' IF PRNT$<>"Y" THEN RETURN
' IF SENSE$="OUTID" OR SENSE$="INPID" OR SENSE$="FEELI"_
' THEN LPRINT " ";
' LPRINT " @";STOREPOS;SENSE$;",";SCANPRINT$;" LEVEL=";LEVEL;"DOING AT";DOPOS$;"-->";
' LPRINT
RETURN