1. Huge arrays - around 46233 elements
- Posted by Jeffrey Fielding <JJProg at CYBERBURY.NET> Mar 15, 1997
- 935 views
I wrote a simple tick-tack-toe program which would go through all the possible moves it could make and decide which would make it more likely that the other player would not win. I need every possible combanation of 1, 2, 3, 4, 5, 6, 7, and 8 elements. So, origonally I calculated it while the program was running, but that took way too long and about 98% of the calculations weren't used. So I calculated all the info in advance and then put it into a constant in the program. When I run the program, it says "sub program too large" or something like that. It didn't even get to the code yet! Anyway, the whole program eas about 49,000 lines. Is this because I am using the Public Domain Edition or does Euphoria not support such large arrays (about 46233)? Could I store this info in a file and then read it when the program loads? JJProg the Techie JJProg at cyberbury.net http://members.aol.com/jjfwiz/index.htm
2. Re: Huge arrays - around 46233 elements
- Posted by David Alan Gay <moggie at INTERLOG.COM> Mar 15, 1997
- 906 views
> I wrote a simple tick-tack-toe program which would go through all the > possible moves it could make and decide which would make it more likely > that the other player would not win. I need every possible combanation of > 1, 2, 3, 4, 5, 6, 7, and 8 elements. So, origonally I calculated it while > the program was running, but that took way too long and about 98% of the > calculations weren't used. So I calculated all the info in advance and then > put it into a constant in the program. When I run the program, it says "sub > program too large" or something like that. It didn't even get to the code > yet! Anyway, the whole program eas about 49,000 lines. Is this because I am > using the Public Domain Edition or does Euphoria not support such large > arrays (about 46233)? Could I store this info in a file and then read it > when the program loads? > JJProg the Techie Euphoria can support any size of array, pending memory of course. The wall you appear to be hitting is the actual number of source code lines...it's not a limitation in the Public Domain version, as I am a registered owner and hit that message too when I was converting my bitmaps into Euphoria source code. The best thing you can do is either break the constant assignment down into several stages (instead of one mega-long assignment statement, create your array using two or more assignment statements that are smaller in length) or load from a file outside your program. Hope this helps David Gay
3. Huge arrays - around 46233 elements
- Posted by Robert Craig <robert_craig at COMPUSERVE.COM> Mar 15, 1997
- 919 views
Jeffrey Fielding writes: > put it into a constant in the program. When I run the program, it says "sub > program too large" or something like that. It didn't even get to the code > yet! Anyway, the whole program was about 49,000 lines. Is this because I am > using the Public Domain Edition or does Euphoria not support such large > arrays (about 46233)? Could I store this info in a file and then read it > when the program loads? There is a (large) limit on the size of the "top level" code, and there is a (large) limit on the size of any one subroutine. You can have as many subroutines as you like however. It sounds like your huge constant declaration caused you to exceed the limit on the "top level" code. There's no difference between the Public Domain and the Complete Edition in this regard. I would recommend that you store the data in a separate data file and read it in. You could even open() your existing file and, with some minor modifications, read in all the numbers with a single get(). Euphoria supports sequences with millions of elements (provided you have enough memory). If the numbers are all between 0 and 255 you could store one number per byte in a file, and read them in with getc(). This would give you a much smaller file that could be loaded much faster. Regards, Rob Craig Rapid Deployment Software