raganwald / cafeaulife Goto Github PK
View Code? Open in Web Editor NEWGosper’s HashLife in CoffeeScript
Gosper’s HashLife in CoffeeScript
Some of these comments really seem unnecessary. for example:
# Export `Cell`
_.defaults exports, {Cell}
I think that is obvious enough that the code is "exporting" 'Cell'. I couldn't tell you why though.
My second criticism is that it seems comments are all too often of the "what" variety. Simply translating the code to english. That's not really very helpful. Once someone has some grasp of the programming language being used, the "what" is right there in the programming language. No need to restate it in another language.
Is precomputing 65,536 seeds really a win? Maybe the time to compute the square is insignificant next to the time to allocate the objects and stuff them in the hash table. If we go this way, need to precompute the hashes as well. Which means that the seeds break if the hash function changes.
Or maybe they have their own hash function, a special case number from 0..65535. Which implies that hash codes should be independant of bucket sizes, which allows us to increase the size of the bucket list to create a cuckoo hash.
Defaults?
Canonicalize intermediate squares?
README.md should explain why the project exists, how to run it, and so forth. The source should explain the code.
Need to carefully think whether we can use Gosper’s quadtrees. Consider 4x4:
1122
1122
4433
In generation 1, we can change 1, 2, 3, and 4. In generation 2, we do:
....
.55.
.55.
....
Thus, a 4x4 square has a velocity of 2. Need to ponder whether larger squares can decompose to 4x4.
Need to be able to compute “rabbits” without going over 900,000 squares in the cache. Some options:
Asking for too much from a square class. Consider moving the resize_to functionality out as well.
Use do or whatever. Pull it the funk out of constructor code.
given a value of n
, it does nothing, inflates, or deflates as need be.
If a diagram is the best way to describe a function, use a diagram to describe a function.
perhaps a mirror bucket list? Crawl the tree hashing everything found that hasn’t already been added to the tree.
...which breaks results for non-trivial squares
And rename it hash code
Square.cache.find_or_create
should know whether to calculate the result or perform it recursively.
The distinction between alive and dead only matters to the engine for hashing purposes. The rest of the potential logic should be reserved for the code that generates the level two seeds.
Move forward fewer than 2^(L-1) generations when generating a result.
Possibly degeneralize it and move the from_json stuff into the api module
Could this be the secret to optimizing 2^n+1?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.