Trying to get the most out of RAM
June 10, 2010
I believe i am running into some ram issues with my chess code. Let me put this into perspective for you. There are 38 arrays, each with 120 integers in them. 12 of those arrays are look up tables. So i used PROGMEM on them so that they are stored in the flash memory and not transfered into ram. Many other integers too. But my program will not run with all of its functions.
The most i can get is 11 out of my 12 functions. Even more functions will be added.
Basically i am trying to run all my functions:
all_moves_bknights(); // all these functions determine all the possible legal moves for a specific piece.
So the program works if i only have it call to the first 11 but when i try and call to all 12 then the program doesnt even run at all. Would this be a sign of a ram issue? Each function works individually too. I wish i knew exactly how much ram i am using. The arduino mega has 8k of ram.
How do you think i can save on ram? or is there no way to with such a large program? its going to be probably 50,000 bytes when done and i need to add even more functions that are probably more ram consuming than these, like calculating the best move. Should i get some slave arduinos?