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
| // PUBLIC DOMAIN | |
| // | |
| // Single function that implements A-Star pathfinding algorithm in ~75 lines of code | |
| // | |
| // (why use a huge library..?) | |
| // | |
| // Parameters: | |
| // solid array of booleans (of size width * height) that determine if a tile is solid | |
| // width width of the map | |
| // height height of the map |
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
| $ cat smush.c | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| static uint32_t seed = 0, i = 0; | |
| uint32_t smush(){ | |
| const uint32_t m = 0x5bd1e995; | |
| const uint32_t k = i++ * m; | |
| seed = (k ^ (k >> 24) ^ (seed * m)) * m; | |
| return seed ^ (seed >> 13); |
NewerOlder