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
| var magnitude = function(xcomp,ycomp) { return Math.sqrt(xcomp*xcomp + ycomp*ycomp); }; | |
| var RESOLUTION = window.innerWidth/2; // 320; | |
| var HEIGHT = window.innerHeight/2; //480; | |
| var div = function(x,y){ return Math.floor(x/y) }; | |
| var mod | |
| var CIRCLE = Math.PI * 2; | |
| function Controls() { | |
| this.codes = { 37: 'left', 39: 'right', 38: 'forward', 40: 'backward' }; |
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
| --[[ | |
| javascript: | |
| function SomeObject(name) { | |
| this.name = name | |
| } | |
| SomeObject.prototype.getName = function() { | |
| return "My Name is "+this.name+"!"; | |
| } |
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
| /* lessons learnt: | |
| - inside other functions you can't do func bla (); | |
| (use bla := func() ...) | |
| - Too many values usually indicates you didnt specify return values in prototype | |
| */ | |
| type cbfunc func(int,float64); | |
| foreach64 := func (xs []float64, fn func(int, float64)) { | |
| for i,v := range(xs) { | |
| fn(i,v); |
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
| 20 [10.000000, was multiplied by 2] | |
| 23 [10.000000, was added to 13] | |
| 24 [12.000000, was multiplied by 2] | |
| 37 [12.000000, was multiplied by 2][24.000000, was added to 13] | |
| 56 [15.000000, was + 13][28.000000, was X2] |
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
| (ns boids-gl.core | |
| (:import (org.lwjgl LWJGLException ) | |
| (org.lwjgl.opengl Display DisplayMode GL11)) | |
| (:gen-class)) | |
| (defn start [] | |
| (let [ display (DisplayMode. 800 600) ] | |
| (try | |
| (do |
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
| (defproject roggy "0.1.0-SNAPSHOT" | |
| :description "FIXME: write description" | |
| :url "http://example.com/FIXME" | |
| :license {:name "Eclipse Public License" | |
| :url "http://www.eclipse.org/legal/epl-v10.html"} | |
| :dependencies [[org.clojure/clojure "1.6.0"] | |
| [org.lwjgl.lwjgl/lwjgl "2.9.1"] | |
| [org.lwjgl.lwjgl/lwjgl-platform "2.9.1" | |
| :classifier "natives-osx" | |
| ;; LWJGL stores natives in the root of the jar; this |
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
| package main | |
| import ( | |
| "fmt" | |
| "github.com/veandco/go-sdl2/sdl" | |
| "os" | |
| ) | |
| var winTitle string = "Go-SDL2 Events" | |
| var winWidth, winHeight int = 800, 600 |
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
| package main | |
| import ( | |
| "fmt" | |
| "github.com/veandco/go-sdl2/sdl" | |
| "os" | |
| ) | |
| type ( | |
| AnyType interface{} |
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
| /* | |
| according to Church you can represent a datastructure by means of a function like so: | |
| \x\a\b.x(a,b) where a and b are given constants and x is a function to be provided later... | |
| */ | |
| function cons(head, tail) { | |
| return function (e) { | |
| return e(head, tail); | |
| } | |
| } | |
| /* |
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
| package main | |
| import "fmt" | |
| type Any interface{} | |
| type FuncType func(Any, Any) Any | |
| type ConsType func(FuncType) Any | |
| func Cons(a, b Any) ConsType { | |
| return func(fn FuncType) Any { |