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
| #include "exotique.h" | |
| #define CELL_SIZE 16 | |
| #define GAME_SIZE 32 | |
| #define MAX_SNAKE_LEN (GAME_SIZE*GAME_SIZE) | |
| /* required screen dim constants for exotique */ |
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
| typedef struct { | |
| int tile_x, int tile_y; | |
| int num_polys; // idk just put whatever here | |
| volatile s64 finished; // used to let the master thread know when this thread is finished | |
| } thread_params; | |
| thread_pool_function(rasterize_tile_thread, arg_var) | |
| { | |
| thread_params* tp = (thread_params*)arg_var; | |
| rasterize_tile(tp->tile_x, tp->tile_y, ...); |
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
| <!DOCTYPE html> | |
| <html> | |
| <head></head> | |
| <body> | |
| <canvas id="canvas-id" style="image-rendering:pixelated;"></canvas> | |
| <script type="text/javascript"> | |
| // triangles are |
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
| // no includes | |
| typedef typeof(sizeof(0)) size_t; | |
| #define NULL 0 | |
| int printf ( const char * format, ... ); | |
| void* memcpy(void *dest, const void * src, size_t n); | |
| void exit(int); |
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
| func isLeap(y int) bool { | |
| if y%4 == 0 { | |
| if y%100 == 0 { | |
| return y%400 == 0 | |
| } | |
| return true | |
| } | |
| return false | |
| } |
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
| #include <ctype.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| typedef enum { | |
| SUCCESS, // parsed | |
| FAILURE, // didn't parse | |
| ERROR // bad syntax | |
| } status; |
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
| #include <stdio.h> | |
| #include <stdint.h> | |
| int columns[8] = {-1,-1,-1,-1,-1,-1,-1,-1}; | |
| int num_solutions = 0; | |
| void print_queens() { | |
| for(int y = 0; y < 8; y++) { | |
| for(int x = 0; x < 8; x++) { | |
| putchar(columns[x] == y ? 'Q' : '.'); |
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
| (defun compile-bf (program) | |
| (let ((loop-stack (list))) | |
| (let ((translated (loop for char across program appending | |
| (case char | |
| (#\> '((incf pointer))) | |
| (#\< '((decf pointer))) | |
| (#\+ '((incf (aref memory (wrap-pointer pointer))))) | |
| (#\- '((decf (aref memory (wrap-pointer pointer))))) | |
| (#\. '((format t "~a" (code-char (aref memory (wrap-pointer pointer)))))) | |
| (#\, '((setf (aref memory (wrap-pointer pointer)) (char-code (read-char))))) |
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
| // compile lambda calculus in a few lines (^: | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <ctype.h> | |
| #include <string.h> | |
| #include <setjmp.h> | |
| // syntax tree structures and utility functions |
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
| // interpret lambda calculus in a few lines (^: | |
| #include "stdio.h" | |
| #include "stdlib.h" | |
| #include "ctype.h" | |
| #include "string.h" | |
| #include "setjmp.h" | |
| typedef enum { | |
| APPLICATION, LAMBDA, SYMBOL | |
| } type; |
NewerOlder