开发者

How to store big map j2me

开发者 https://www.devze.com 2023-02-25 12:14 出处:网络
I need to create 3000x3000 bit map for coords of my robots. In theory I have a array MxM, M=3000, and if my robot see somthing, then in coords [5][5] example I put 1, if see nothing then 0.

I need to create 3000x3000 bit map for coords of my robots. In theory I have a array MxM, M=3000, and if my robot see somthing, then in coords [5][5] example I put 1, if see nothing then 0.

  1. When I tried create int[][] b = new int[3000][3000] I have a problem - outofmemory.

  2. I tried use RMS, but I can create 3000 rows, but only 50 cols

  3. I think to use textfile, but I need a custom update开发者_如何学JAVA, and working with textfile very hard in j2me.

Thanks for reply!


Some approaches:

  • Store your coordinates in a file, and load and update only those rows/columns of data into memory, that surround the robot (maybe a 10x10 matrix). Buffering.
  • Use a quadtree algorithm to store your coordinates. You may have to use the external file approach here too, but maybe you can think of something better.
0

精彩评论

暂无评论...
验证码 换一张
取 消