Last active
October 16, 2018 19:16
-
-
Save monkstone/b06b058c2f3c3e52c8d8b741553b8ab0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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