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
instructions = [] | |
f = open("input.grs", "r") | |
src = str(f.read()) | |
f.close() | |
def var_emit(line): | |
name = line[1:].strip() | |
instructions.append(["MAKEVAR", name]) |
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 "builder.h" | |
// | |
// Begins construction of string | |
// | |
struct StringBuilder sbstart() { | |
return (struct StringBuilder) { | |
.str = NULL, | |
.size = 0, | |
.capacity = 0 |
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 <string.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
typedef struct { | |
const char *src; | |
} _obj_Parser; |
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 "particle_system.h" | |
#include "camera.h" | |
#include <SDL2/SDL_render.h> | |
#include <stdint.h> | |
static int particle_rand(u32 *seed) { | |
return (((*seed = *seed * 214013L + 2531011L) >> 16) & 0x7fff); | |
} | |
/// Create partcile system |
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
use std::collections::btree_set::*; | |
type Id = usize; | |
#[derive(Debug)] | |
pub struct BucketArray<T> | |
{ | |
items: Vec<T>, | |
free: BTreeSet<usize> | |
} | |
impl<T> BucketArray<T> |
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
use std::collections::hash_map::*; | |
fn solve(crule: &RuleCont, rules: &HashMap<usize, Rule>, s: &str, offs: usize) -> (usize, bool) | |
{ | |
let mut moffs = offs; | |
match crule | |
{ | |
RuleCont::Seq(irules) => { | |
let mut valid = true; | |
let remoffs = moffs; |
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
use std::collections::hash_map::*; | |
use std::time::SystemTime; | |
#[derive(Hash, Copy, Clone, PartialEq, Debug, Eq)] | |
struct Vec3(i8, i8, i8); | |
#[derive(Hash, Copy, Clone, PartialEq, Debug, Eq)] | |
struct Vec4(i8, i8, i8, i8); | |
impl Vec4 | |
{ |
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
testData = {- Your data, split by newline -} | |
data CellType = Seat | Occupied | Floor deriving(Show, Eq) | |
cellFrom 'L' = Seat | |
cellFrom '#' = Occupied | |
cellFrom '.' = Floor | |
fromJust (Just x) = x | |
fromJust Nothing = error "unwrapped nothing" |
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
testData :: [Int] | |
testData = [11,6,42,19,23,20,26,4,2,36,35,41,18,38,28,1,48,5,17,10,32,15,46,50,24,3,7,6,8,68,83,23,11,16,4,36,9,78,12,29,13,25,42,14,84,10,17,15,18,28,19,21,20,22,35,24,45,30,67,50,23,40,27,26,31,38,33,25,42,29,32,34,57,41,70,43,44,46,65,75,47,48,89,49,51,61,60,52,54,56,99,86,90,72,104,77,78,84,85,95,87,109,132,126,96,108,101,129,233,103,106,172,153,110,128,175,149,150,155,165,161,181,222,180,242,422,238,403,204,258,209,207,213,528,216,635,303,260,259,304,482,299,693,342,326,361,435,384,467,429,607,844,420,842,474,422,762,558,475,476,564,519,620,660,625,1100,641,668,837,745,781,804,903,1167,851,895,894,1587,950,1034,897,951,1039,994,1221,1083,1285,1245,1429,1472,1309,2061,1413,1695,1933,2423,1698,2172,1745,1985,3242,2738,1847,1848,1891,2239,1945,2328,2077,2304,2368,2530,3490,3170,3260,3004,3108,3111,3393,4313,3876,3443,3592,3593,3695,3738,3739,3968,3793,3836,6901,4249,4381,4445,5476,4898,5534,7871,6447,6112,6836,6219,10428,7132,7035,9857,7629,7185,7288,7477,9272,7532,7761,8042,15962,8630,869 |