Back to project page blocks-game.
The source code is released under:
Apache License
If you think the Android project blocks-game listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package cz.kotu.game.blocks; // w w w .ja v a2s . com import com.badlogic.gdx.utils.Predicate; import cz.kotu.grids.Dir; import cz.kotu.grids.Pos; public class GridUtils { public static int getNeighHash(Pos pos, Predicate<Pos> predicate) { int hash = ((predicate.evaluate(pos.inDir(Dir.E))) ? 1 : 0) + ((predicate.evaluate(pos.inDir(Dir.N))) ? 2 : 0) + ((predicate.evaluate(pos.inDir(Dir.W))) ? 4 : 0) + ((predicate.evaluate(pos.inDir(Dir.S))) ? 8 : 0); return hash; } }