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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
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 "perlin.h" | |
perlin::perlin(){ | |
int permutation[] = { 151,160,137,91,90,15, | |
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, | |
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, | |
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, | |
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, | |
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, | |
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, |
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
#coding: utf-8 | |
L=0.1 #長さ | |
M=10 #分割数 | |
dx=L/M #空間刻み | |
dt=1.0 #時間刻み | |
N=100 #時間ステップ数 | |
alpha=80.2/(7874.0*440.0) #熱伝導率 | |
gamma=dt/dx**2 | |
a=alpha*gamma |
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
#coding: utf-8 | |
L=0.1 #長さ | |
M=10 #分割数 | |
dx=L/M #空間刻み | |
dt=1.0 #時間刻み | |
N=100 #時間ステップ数 | |
alpha=80.2/(7874.0*440.0) #熱伝導率 | |
gamma=dt/dx**2 | |
a=alpha*gamma |
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> | |
int p[512]; | |
void init(){ | |
int permutation[] = { 151,160,137,91,90,15, | |
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, | |
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, |
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 <iostream> | |
#include <random> | |
#include <sstream> | |
#include <memory> | |
using namespace std; | |
struct Door{ | |
bool state[3]; //goat(false) or prize(true) | |
int player; |
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
func recursiveClosure(factorialImp: (UInt->UInt, UInt) -> UInt) -> (UInt->UInt) { | |
var closure:(UInt->UInt)! | |
closure = { (value:UInt) -> UInt in | |
return factorialImp(closure, value) | |
} | |
return closure | |
} | |
let factrial = recursiveClosure{(closure:UInt->UInt,value:UInt) -> UInt in | |
return value == 0 ? 1 : value * closure(value-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
class MultiArray<T>{ | |
var size:[Int] | |
var data: [T?] | |
init(size:Int...){ | |
self.size = size | |
let multiply = { (a:Int, b:Int) -> Int in a * b} | |
data = [T?](count: size.reduce(1,combine: multiply), repeatedValue: nil) | |
} |
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
import GLKit | |
import OpenGLES | |
let gVertices: [GLfloat] = [ | |
-0.5, -0.5, 0.0, | |
-0.5, 0.5, 0.0, | |
0.5, -0.5, 0.0, | |
0.5, 0.5, 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
//: ## Mandelbrot Set | |
let result = calc() | |
draw(result) |
NewerOlder