Skip to content

Instantly share code, notes, and snippets.

@monkstone
Last active October 16, 2018 19:16
Show Gist options
  • Save monkstone/b06b058c2f3c3e52c8d8b741553b8ab0 to your computer and use it in GitHub Desktop.
Save monkstone/b06b058c2f3c3e52c8d8b741553b8ab0 to your computer and use it in GitHub Desktop.
import java.util.HashMap;
public class TerrainHeight{
public HashMap<Integer, Float> terrain;
public TerrainHeight(){
terrain = new HashMap<>();
}
public void storeHeight(int x, int y, float value){
terrain.put(hashKey(x, y), value);
}
public float getHeight(int x, int y){
return terrain.get(hashKey(x, y));
}
public Integer hashKey(int x, int y){
return 5000 * y + x;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment