This file contains 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
/* Tiny calc | |
* | |
* Copyright (c) 2021 Al-buharie Amjari <healer.harie@gmail.com> | |
* | |
* This file is license under MIT license | |
* | |
*/ | |
#include <ctype.h> | |
#include <stdio.h> |
This file contains 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
/* REPLY CHALLENGE | |
* | |
* Minimal deterministic parser | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define ERROR(...) fprintf(stderr, __VA_ARGS__) | |
#define UNEXPECTED(x) {\ | |
if (x!=TOK_ERR) \ |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <assert.h> | |
#include <png.h> | |
#ifdef NDEBUG | |
#error "Don't turn NDEBUG!!" | |
#endif |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <assert.h> | |
#include <png.h> | |
#ifdef NDEBUG | |
#error "Don't turn NDEBUG!!" | |
#endif |
This file contains 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
const int main[] = { | |
-476053503, -443744256, -442695680, -494927871, | |
-443744256, -476045300, -509603825, -494858196, | |
-476053503, -476024828, -285212672, -352321537, | |
-442695680, -481296284, -905969664, -352321551, | |
-476053504, -476024831, -285212672, 1819043176, | |
1634017391, 174617714, -1610612736, 805248739, | |
225, 2147483420, 1 | |
}; |
This file contains 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
#include <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define UNEXPECTED(c) \ | |
{ \ | |
if (c != TOK_ERROR) { \ | |
fprintf(stderr, "stream:%d:%d error: unexpected %s\n", line_tok_found, \ | |
column_tok_found, tok_str(c)); \ | |
} \ |
This file contains 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
#include <assert.h> | |
#include <math.h> | |
#include <png.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define FRAMES 300 | |
struct vec3D { | |
double x, y, z; |
This file contains 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
#include <assert.h> // so I wont have to do error handling | |
#include <math.h> | |
#include <png.h> // to output frames as png files | |
#include <stdio.h> // I/O | |
#include <stdlib.h> | |
#include <string.h> | |
#define FRAMES 50 | |
/* this may be a vertex or a vector */ |
This file contains 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
#include <stdio.h> | |
#include <math.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <stdint.h> | |
static double derivative(double x){ | |
return pow(M_E, -pow(x, 2.0)/2.0)/sqrt(2.0*M_PI);} | |
int main(int argc, char **argv) { |
This file contains 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
#include <assert.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
double init_fluid(double x) { | |
return 100.0 * sin(2.0 * M_PI * 0.4 * x) * | |
pow(M_E, -pow(x - 15.0, 2.0) / (3.6 * 2.0)) / (3.6 * sqrt(2.0 * M_PI)); | |
} |