Author |
Message |
PaddyLong
|
Posted: Wed Jun 04, 2003 5:07 pm Post subject: (No subject) |
|
|
from what I found from trying this, your values for north and south are backwards.. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
bugzpodder
|
Posted: Wed Jun 04, 2003 5:08 pm Post subject: (No subject) |
|
|
Catalyst wrote: i like the ; and ()
u could write a generic class
and have the users classes overide the base (like virtual functions)
class using deferred
or
you could have the functions and procedure outside the program
and brought in using parameters to the class
I basically want something that without modifying my code, I could specify which AIs to use. or if thats not possible then i need to at least have the pointers/functions stored in an array so i could loop through them in my code. i am not interested in having seperate calls to each AI using their name. anyone? |
|
|
|
|
|
bugzpodder
|
Posted: Wed Jun 04, 2003 5:13 pm Post subject: (No subject) |
|
|
i can think of one way, is where we can have compiled programs and I'll use Sys.Exec to execute the programs, which will read in a file and output to a file. but then again, i think turing does not way the command executed by Sys.Exec to finish and goes on, right? |
|
|
|
|
|
bugzpodder
|
Posted: Wed Jun 04, 2003 5:15 pm Post subject: (No subject) |
|
|
PaddyLong wrote: from what I found from trying this, your values for north and south are backwards.. i dont think so. 0,0 is at the top left corner. |
|
|
|
|
|
Catalyst
|
Posted: Wed Jun 04, 2003 5:19 pm Post subject: (No subject) |
|
|
you can have the users load their Think funcs into a generic class
oh, and in turing bottom-right is 0,0 |
|
|
|
|
|
PaddyLong
|
Posted: Wed Jun 04, 2003 5:26 pm Post subject: (No subject) |
|
|
I think what catalyst suggested is probably the best way.
oh yeah, you can have an array of pointers to classes which I think you said you couldn't in a previous post...
ex...
code: |
var classarray : array 1 .. 4 of ^someclass
for q:1..4
new classarray (q)
end for
|
so just have like a Snake or Player class that has their X, Y position as well as their current direction
then for the think function, just pass up the X, Y positions of the other players as a parameter (probably need to have getPos functions in the Snake class that just results the X and Y position - this is so that cou can actually fill this array that you are passing to the think function with the data from all of the Snake objects) |
|
|
|
|
|
bugzpodder
|
Posted: Wed Jun 04, 2003 5:33 pm Post subject: (No subject) |
|
|
Catalyst, could you give an simple example?
PaddyLong, I am well aware of that. but since every AI have a *different* class name, then it is impossible to do what you suggested, since I want an array of pointers to *different classes*. inheritance/implementation of classes still results a different class (ie a class of different name) and therefore i cant put them in an array, at least i dont think. a run-time solution is even more impossible, since now i have to basically replace class names with strings. |
|
|
|
|
|
PaddyLong
|
Posted: Wed Jun 04, 2003 5:45 pm Post subject: (No subject) |
|
|
lol I just figured out what you were talking about... wasn't thinking of how each of the things wouldn't have its unique AI if they all were one class
what is the maximum number of AI's you plan to have competing at once? Like are you going to do it as a sort of tournament ladder or just have everyone in on a big free for all? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
bugzpodder
|
Posted: Wed Jun 04, 2003 5:50 pm Post subject: (No subject) |
|
|
i'd like to have a big free for all but looks like that its not really possible unless manually modify the Engine for all AIs. which is not good.
but pointers, boiled on to the end, are really only integers/addresses. i was wondering if i could exploit this fact so i could at least have an areaay of pointers to different classes |
|
|
|
|
|
PaddyLong
|
Posted: Wed Jun 04, 2003 5:59 pm Post subject: (No subject) |
|
|
maybe... but each class might take up a different amount of memory and so you might not be able to |
|
|
|
|
|
bugzpodder
|
Posted: Wed Jun 04, 2003 6:00 pm Post subject: (No subject) |
|
|
pointers are not classes, they are merely pointers, that stores an address (just a simple integer) of a memory. at least thats how it works in C++ |
|
|
|
|
|
PaddyLong
|
Posted: Wed Jun 04, 2003 6:12 pm Post subject: (No subject) |
|
|
yeah I know what pointers are... but liek you might not just be able to guess where the addresses of the different classes are based on what the address of a given class is |
|
|
|
|
|
bugzpodder
|
Posted: Wed Jun 04, 2003 6:18 pm Post subject: (No subject) |
|
|
i have no idea what you mean by "guessing" in C++ you dont need to guess, just declare it and you have the address (i mean, you either know the address or you dont, you cant "guess"). cept turing wont let you do this... |
|
|
|
|
|
PaddyLong
|
Posted: Wed Jun 04, 2003 6:19 pm Post subject: (No subject) |
|
|
nm, I now udnerstadn what you were talking about by having an array of pointers |
|
|
|
|
|
bugzpodder
|
Posted: Wed Jun 04, 2003 6:27 pm Post subject: (No subject) |
|
|
got it, turing use pointer to "anyclass" to do this. but i still have to modify my program each time i want to use a class of different name. anyone know how to avoid this? |
|
|
|
|
|
|