I need helpText File Type. 
Author Message
 I need helpText File Type.

Hi,
I'm making an "eliza" program. Eliza is (i think) the first artifial
inteligence program. it was written in lisp, then in basic and i'm
trying to translate it from basic to tp7.
 My problem is the DATA instruction in basic. How do i translate it to
Pascal? i prefer usinf a text file for it, but i can't figure how to
do this.
Any help will be appreciated!!!

Thanks.

Yoav



Wed, 18 Jun 1902 08:00:00 GMT  
 I need helpText File Type.

Quote:

>Hi,
>I'm making an "eliza" program. Eliza is (i think) the first artifial
>inteligence program. it was written in lisp, then in basic and i'm
>trying to translate it from basic to tp7.
> My problem is the DATA instruction in basic. How do i translate it to
>pascal? i prefer usinf a text file for it, but i can't figure how to
>do this.
>Any help will be appreciated!!!
>Thanks.
>Yoav

Instead of the Basic Data statements, you could use an array of
STRING[80] (if 80 chars is enough), store all the responses as lines
of text (which you could edit with the DOS editor) then read all the
responses into the array from disk. These array elements can then be
referenced by the index of the array element to "fake" the
psychological response, "And how do you feel about your mother?", etc.

A sketch of this is:

CONST
FileName = 'RESPONSE.TXT';
MaxResponse = 125; (* or whatever *)
TYPE
s80 = String[80];

VAR  
f:Text;
res:Array[1..MaxResponse] of s80
indx:Integer;

Begin
        .....
     indx := 0;
     Assign(f, Filename);
     While not eof(f) Do
     Begin
         Inc(indx);            
         Readln(f, res[indx])
     End;
...... and so on.

Regards,



Wed, 18 Jun 1902 08:00:00 GMT  
 I need helpText File Type.



Quote:
>Hi,
>I'm making an "eliza" program. Eliza is (i think) the first artifial
>inteligence program. it was written in lisp, then in basic and i'm
>trying to translate it from basic to tp7.
> My problem is the DATA instruction in basic. How do i translate it to
>pascal? i prefer usinf a text file for it, but i can't figure how to
>do this.
>Any help will be appreciated!!!

If you create a text file and place each item on a separate line
then you can simply map basic's read to readln and basic's
restore to reset.

    ...red

--
I have moved:

http://users.southeast.net/~rdonais/index.html
ftp://users.southeast.net/~rdonais/00index.txt



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need to read type 0 PCX file in TP30

2. Files : Text type help needed

3. APPEND to a file of record typed file

4. How to file/record lock a typed file.

5. Text file to Type File!

6. Need Help On Enumerate Types

7. Need early Turbo Pascal data type details

8. fast putchar procedure and remove cursor procedure needed for lord II type game

9. Need Gnu equivalent for type 'Registers'

10. Needed: A spreadsheet type of component

11. D3/Access: Need Support for Access 97/DAO3.5/GUID types

12. Need help with type casting on numeric values from AVG aggregate functions

 

 
Powered by phpBB® Forum Software