Creating Variables in run time
Author |
Message |
lordroba

|
Posted: Sun Aug 07, 2005 3:26 pm Post subject: Creating Variables in run time |
|
|
Is there a way to create/declare variables during RUN TIME in Turing?
For example, Turing was coded is some language, and while turing is running you can declare and create new variables in it. I want to do the same thing, but make a program where you can add new variables while it's running. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
zylum

|
Posted: Sun Aug 07, 2005 4:17 pm Post subject: (No subject) |
|
|
i doubt it. why would you want to do that anyways? |
|
|
|
|
 |
[Gandalf]

|
Posted: Sun Aug 07, 2005 4:28 pm Post subject: (No subject) |
|
|
No. Turing is programmed in C mostly, bit of C++.
You might want to check flexible arrays though, they might help you. |
|
|
|
|
 |
Tony

|
Posted: Sun Aug 07, 2005 8:07 pm Post subject: (No subject) |
|
|
what are you trying to acomplish though?
users don't usually interact with variables anyways. |
|
|
|
|
 |
Cervantes

|
Posted: Sun Aug 07, 2005 9:24 pm Post subject: Re: Creating Variables in run time |
|
|
lordroba wrote: For example, Turing was coded is some language, and while turing is running you can declare and create new variables in it.
The window you type your code into is called the IDE. Integrated Development Environment. While the IDE is running, you do nothing more than type in a big text box. The variables are not actually created or declared; rather, it's just text changing. When you hit F1, your code is interpreted and executed, and it is then when memory is allocated for your variables.
Wtd said something a while ago about how people often think the IDE and the programming language are the same thing. This is a good example of it, I suppose. They aren't!
But yes, as Gandalf mentioned, look into Flexible Arrays. |
|
|
|
|
 |
lordroba

|
Posted: Fri Aug 12, 2005 9:35 am Post subject: (No subject) |
|
|
kk thanks
the reason i was asking was cause i was interested in AI programming. I figured there's only a certain amount of variables you can set before the program runs, and i you want an AI that can learn alot, then after sometime, all the intial variables will be filled and it will need to create new ones during run time to accomodate all the incoming information and be able to interprate it. This would allow for infinite storage of information and the ability to constantly learn more and more(much like the human brain) |
|
|
|
|
 |
[Gandalf]

|
Posted: Fri Aug 12, 2005 6:30 pm Post subject: (No subject) |
|
|
Then you would just use file i/o. Read in the data, write out the data. The program would interpret what is in the file with no need for 'variables'. If you have a question, you store it in the brain.txt file, alongside the answer and then have the program use it for future reference, things like that.
The storage is just how much the hdd of the computer can hold, which most people agree, would be less than what a human brain can hold (although they are very different). Anyway, the more data you have stored, the slower the reading process will be. You might want to have seperate 'brain' databases, one for questions (ie. sentence ends in '?') or one for names, etc. |
|
|
|
|
 |
Mazer

|
Posted: Tue Aug 16, 2005 9:19 am Post subject: (No subject) |
|
|
Perhaps a flexible array of pointers? I don't know if it's possible though, as I've never tried Turing's pointers. And if it does it'd just be a bitch to work with.
But good luck with whatever you end up trying. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
|
|