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
Film "image" | |
"integer xresolution" [1280] "integer yresolution" [1024] | |
Sampler "lowdiscrepancy" "integer pixelsamples" [8] | |
PixelFilter "box" | |
LookAt 10 4 10 0 0.5 0 0 1 0 | |
Camera "perspective" "float fov" [20] |
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
#[deriving(Show)] | |
enum List<T> { | |
Node(T, ~List<T>), | |
Nil, | |
} | |
impl<T> List<T> { | |
fn len(&self) -> uint { | |
match *self { | |
Node(_, ref tail) => tail.len() + 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
int Board::countLivingNeighbors(const Cell& cell) const { | |
auto living = 0; | |
if (isAlive(Cell(cell.x - 1, cell.y))) { ++living; } | |
if (isAlive(Cell(cell.x - 1, cell.y - 1))) { ++living; } | |
if (isAlive(Cell(cell.x - 1, cell.y + 1))) { ++living; } | |
if (isAlive(Cell(cell.x, cell.y - 1))) { ++living; } | |
if (isAlive(Cell(cell.x, cell.y + 1))) { ++living; } | |
if (isAlive(Cell(cell.x + 1, cell.y))) { ++living; } | |
if (isAlive(Cell(cell.x + 1, cell.y - 1))) { ++living; } |
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
def next(life, power, counters): | |
for _ in range(1): | |
life += 2 * power | |
counters += 2 * power | |
power = life + counters | |
return life, power, counters | |
def power_at(turn, life, power, counters): | |
return 5 ** turn * (life + power + 4 * counters) * 2 // 7 |
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
;clang version 3.2 (tags/RELEASE_32/final) | |
;Target: x86_64-unknown-linux-gnu | |
;Thread model: posix | |
; ModuleID = 'degrad.cpp' | |
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" | |
target triple = "x86_64-unknown-linux-gnu" | |
%class.Radians = type { float } |
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
int factorial(int n) | |
{ | |
if(n == 0) { | |
return 1; | |
} else { | |
return n * factorial (n - 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
public int readFile(String filename) | |
{ | |
try | |
{ | |
Scanner scan = new Scanner(new File(filename)); | |
int i = 0 | |
while(scan.hasNext()) | |
{ | |
strings[i] = scan.nextLine(); | |
++i; |
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
from functools import reduce | |
from operator import add | |
#Doesn't handle whitespace padding well | |
def countWords(s): | |
return len(s.split(' ')) | |
def stopLooping(): | |
global looping | |
looping = False |
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 <inttypes.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include "eratos.h" | |
#define PRIME_LIMIT (uint64_t)1e5 | |
#define ALLOWED_CHAINS (uint64_t)30e7 | |
#define ARRAY_ELEMS (uint64_t)40 |
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
package chris; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.io.PrintStream; | |
import java.io.PrintWriter; | |
import java.text.DecimalFormat; | |
import java.util.Scanner; |
NewerOlder