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
/** | |
* This program reads an L-system from standard input and outputs a PGM image. | |
* The following characters are possible: | |
* uppercase: Move forward with pen down | |
* lowercase: Move forward with pen up | |
* +: turn left | |
* -: turn right | |
* [: push current turtle state | |
* ]: pop turtle state | |
* usage: turtle ANGLE STEP_SIZE > output.pgm |
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
#!/usr/bin/env ruby | |
grammar, iterations, extra = ARGV | |
if grammar == nil or !File.exists?(grammar) | |
puts "no grammar file" | |
exit | |
end | |
symbols = {} |
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 <SDL/SDL.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <math.h> | |
#define SIZE 800 | |
#define PRECISION 300000 | |
struct paird{ | |
double x, y; |
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
/* This program uses SDL. | |
* To install: | |
* | |
* sudo apt-get install libsdl1.2-dev | |
* | |
* To compile: | |
* | |
* gcc -lSDL filename.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
/** | |
* This needs Nvidia's CUDA library, and SDL installed. | |
* You can compile using nvcc: | |
* | |
* nvcc -L/path/to/cuda/lib64 -lcudart `sdl-config --libs --cflags` | |
* | |
*/ | |
#include <stdio.h> | |
#include <assert.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
#include <SDL/SDL.h> | |
#include <SDL/SDL_thread.h> | |
#include <cmath> | |
#include <iostream> | |
using namespace std; | |
double scale = 1.0; | |
double x_offset = 0.0, y_offset = 0.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
require 'benchmark' | |
require 'andand' | |
class Hash | |
def except(*blacklist) | |
{}.tap do |h| | |
(keys - blacklist).each { |k| h[k] = self[k] } | |
end | |
end | |
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
class Hash | |
def except(*blacklist) | |
self.reject {|key, value| blacklist.include?(key) } | |
end | |
def only(*whitelist) | |
self.reject {|key, value| !whitelist.include?(key) } | |
end | |
end | |
NewerOlder