project for 2035
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
Diff: map.cpp
- Revision:
- 4:b687219ae447
- Parent:
- 2:4947d6a82971
- Child:
- 5:cd2bdbfedd21
diff -r 9dde875cd65c -r b687219ae447 map.cpp --- a/map.cpp Tue Nov 24 08:35:47 2020 +0000 +++ b/map.cpp Tue Nov 24 10:26:05 2020 +0000 @@ -33,7 +33,8 @@ * This function should uniquely map (x,y) onto the space of unsigned integers. */ static unsigned XY_KEY(int X, int Y) { - // TODO: Fix me! + //implement pairing function for unique number + return .5(X+Y)(X+Y+1)+Y; } /** @@ -43,14 +44,16 @@ */ unsigned map_hash(unsigned key) { - // TODO: Fix me! + return key%5; } void maps_init() -{ - // TODO: Implement! +{ // Initialize hash table + items = createHashTable(map_hash, 5); // Set width & height + w = 50; + h = 50; } Map* get_active_map()