(Each boolean variable occupies one byte of memory.)
I am very reluctant to use dynamic memory allocation in any embedded system that I expect to run forever. Why do I have misgivings? Lack of garbage collection in the standard library function malloc(). That's why.It is possible to allocate and deallocate memory (repeatedly) in such a way that there is enough memory in the heap to do the job but it is fragmented so that that not enough contiguous memory is available to finish it.I mean, if the application is supposed to do something and quit, that's one thing, but if it is supposed to run forever and you don't know ahead of time how much memory you actually need, then, you are really, really (really) asking for trouble. For simple cases, you might convince yourself that such fragmentation will not occur, but...That's just an opinion (my opinion), and it's worth exactly what you want it to be worth.
[The robot's] task is mapped a "room". He use array to save information about room as square site.