Skip to content

Instantly share code, notes, and snippets.

@snagy
snagy / d2.sc
Created December 4, 2019 23:27
Scopes Closure problem
using import Array
let d2_test = """"1,9,10,3,2,3,11,0,99,30,40,50
fn parse_int (s) #parse an int, assuming nothings wrong because error checking is annoying
local v = 0
print "parsing" s
for c in s
print "char" c
if (c > (@ "9" 0))
@snagy
snagy / index.js
Created February 8, 2013 22:32
voxel.js game
var createGame = require('voxel-engine')
function sphereWorld(x, y, z) {
// return the index of the material you want to show up
// 0 is air
if (x*x + y*y + z*z > 15*15) return 0
return 3
}
var game = createGame({
@snagy
snagy / index.js
Created February 8, 2013 22:32
voxel.js game
var createGame = require('voxel-engine')
function sphereWorld(x, y, z) {
// return the index of the material you want to show up
// 0 is air
if (x*x + y*y + z*z > 15*15) return 0
return 3
}
var game = createGame({
@snagy
snagy / index.js
Created February 8, 2013 22:32
voxel.js game
// Voxel Tetris by @tatarize
// Click the board side to make the piece go that way.
// Click something on the board (eg, the falling piece) to make it turn.
// Turns are currently logged counter clockwise/counter-clockwise depending on the height you clicked at.
var createGame = require('voxel-engine')
var chunkSize = 32
var chunkDistance = 3
var game = createGame({
@snagy
snagy / index.js
Created February 8, 2013 22:32
voxel.js game
var createGame = require('voxel-engine')
function sphereWorld(x, y, z) {
// return the index of the material you want to show up
// 0 is air
if (x*x + y*y + z*z > 15*15) return 0
return 3
}
var game = createGame({