Esteemed teachers, coaches, experts,
This program in Python keeps generating a memory allocation error on the console without running. It runs successfully in Blocks but fails to run in Python. Is there a way to get around this? Is it possible to use an SD card to help with this issue? I have a 1TB SD card with me. I appreciate your time and effort in resolving this issue.
https://drive.google.com/drive/folders/14oNWy7H5OghM6on-o6HB3qyY1S-xeKap?usp=sharing
This code calls many functions that have not been defined. The first example occurs on lines 85 and 86. Unlike C++, Python does not allow the usage of functions before they are defined.
The SD card is irrelevant.
Python syntax aside
The program is too big (it’s failing to compile) for the IQ2 brain.
4 Likes
Thanks for helping identify this error. I will have it corrected.
1 Like
Thanks. How large can programs be for the IQ Gen 2 Brain? Would it be possible to support larger programs in the future?
For Python, there’s no fixed formula. There a maximum size the source can be (your code was at about 75% of that limit) but then the VM has to convert the source to bytecode and that’s far more dependent on the number of variables, functions etc. and is not easy to calculate. C code is easier to handle in this respect.
The limit is determined by available RAM, so no, not really possible. Your code would compile on an EXP brain which has approximately 5 x available memory for user programs as compared to IQ gen 2.
2 Likes