Comments (3)
It is a good point. In AI opponent programming, some kind of caching is inevitable. Especially for recursive algorithms. Even though caching wasn't originally planned to be part of the library, it could be an interesting feature.
While caching brings performance benefits, it also raises some issues. We should think a bit about:
- what shall be cached
- cache invalidation
- memory usage
- thread safety
- cache storage (memory, disk)
If we want to implement caching mechanism, I would use some more generic and reusable solution. For example, LRU/LFU algorithm sounds like a potential fit. It uses a priority queue which is already in place (used by an a-star algorithm)
Here is one more reading. Just for reference.
from hex-grid.
Hi František, Yes, I see the benefits of using LRU/LFU immediately. I'll update my implementation to use one of those, and reply here when I have something to look at and/or review. Thanks!
from hex-grid.
Looking a bit closer at this... it's not so simple as I'd at first imagined. The values that we'll be caching are different types of thing. I could imagine using a cache object for the neighbors example above, for instance, but then you'd need a different cache for allCellsCoordinates
. I could imagine making it generic somehow, so both would be stored in the same cache, but then you've got wildly different "sized" objects stored. I'm not really sure what makes sense, at this point.
I did find an additional article with a more complete example (but pretty similar to the second reference you posted above).
from hex-grid.
Related Issues (12)
- Cell initializer that takes CubeCoordinates is not public. HOT 1
- `Generator.createHexagonGrid` doc comment / functionality missmatch HOT 2
- issues with rectangular generator HOT 3
- Finetune coordinates converter and grid generator
- Intent to flush out drawing instructions in the README HOT 2
- Points x and y properties are not public. HOT 1
- Feature request: Get the pixel width/height of the grid HOT 3
- Feature request: Store user data in cells HOT 6
- Hex to screen wrong implementation HOT 7
- Feature Request: an initializer with a single size for the entire HexGrid HOT 6
- HexSize width & height are not public HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hex-grid.