Skip to content

Instantly share code, notes, and snippets.

View sevvie's full-sized avatar

sevvie Rose sevvie

View GitHub Profile
package mapgen
type PerlinNoisePRNG struct {
seed, octaves int
persistence, frequency, amplitude float64
}
func (prng *PerlinNoisePRNG) NoiseAt(x, y float64) float64 {
n := int(y) * 47 + int(x) + prng.seed
n = (n << 13) ^ n
@sevvie
sevvie / game_test.go
Created September 23, 2012 04:30
Tests for "Having Fun with Go and the Gracious Benefactor"
package doomed
import("testing"; "fmt")
func TestNewBoard(t *testing.T) {
b := NewBoard(17, 17)
if len(b.grid) != 17 { t.Errorf("Board size is wrong!") }
}
func TestGenerator(t *testing.T) {
@sevvie
sevvie / game.go
Created September 23, 2012 04:29
Having fun with Go and the Gracious Benefactor
package doomed
import ("math/rand"; "fmt")
// UGH WHY AM I DOING IT LIKE THIS
const (
Unused = -1
NotGenerated = 0
Mountain = 1
@sevvie
sevvie / gameloop.go
Created September 22, 2012 02:25
Useless example in Go, for the $GB
package main
import( "fmt"; "time" )
// type Board
// The game board
type Board struct {
tiles [][]int
}
@sevvie
sevvie / gist:3317031
Created August 10, 2012 19:17
pegex-cdent
seven@broodmother :: ~/Workspaces/pegex-cdent ‹master*› % make test 2 ↵
mkdir -p lib/Pegex
mkdir -p lib/Pegex/Parser
mkdir -p lib/Pegex/Pegex
mkdir -p lib/Pegex/Grammar
coffee --compile -p src/Pegex/Parser/Indent.coffee > lib/Pegex/Parser/Indent.js
coffee --compile -p src/Pegex/Parser.coffee > lib/Pegex/Parser.js
coffee --compile -p src/Pegex/Pegex/AST.coffee > lib/Pegex/Pegex/AST.js
coffee --compile -p src/Pegex/Pegex/Grammar.coffee > lib/Pegex/Pegex/Grammar.js
coffee --compile -p src/Pegex/Compiler.coffee > lib/Pegex/Compiler.js