Skip to content

Instantly share code, notes, and snippets.

View anissen's full-sized avatar

Anders Nissen anissen

View GitHub Profile
@anissen
anissen / gist:bf234d34a1ab4e75c2f6
Created March 31, 2015 14:05
Markov text generator
class Markov {
var cache :Map<String, Array<String>>;
var words :Array<String>;
public function new() {
words = [];
cache = new Map<String, Array<String>>();
}
@anissen
anissen / gist:0f65cceeddf6c2dce486
Created March 24, 2015 14:54
Hexmage mermaid diagram
graph LR
subgraph User
Action(Action) --> ChangeState
UserEvents(Events)
end
subgraph Game
Commands(Commands) --> ChangeState(<b>Change State</b>)
ChangeState --> Events
Events(Events) --> Commands
@anissen
anissen / RuleParser.hx
Created December 14, 2014 18:40
Parse toy rule language using hxparse
/*
Syntax:
if (condition) then (action)
if [(condition), (condition)] then [(action), (action)]
*/
/*
Testing:
function testRule(correct :Bool, s :String) {
@anissen
anissen / Test.hx
Created November 18, 2014 13:19
hscript test
class Test
{
public static function main() :Void {
var test = new Test();
test.run();
}
public function new() {
@anissen
anissen / luxe_resources.md
Last active August 29, 2015 14:07
Luxe resources
{
"folders":
[
{
"follow_symlinks": true,
"name": "PROJECT NAME",
"path": "/project/path"
},
{
"follow_symlinks": true,
@anissen
anissen / Main.hx
Last active March 26, 2016 16:53
Luxe kitchen sink test
import luxe.Component;
import luxe.Input;
import luxe.Parcel;
import luxe.ParcelProgress;
import luxe.Rectangle;
import luxe.Sprite;
import luxe.Color;
import luxe.tween.easing.*;
import luxe.Text;
// http://try.haxe.org/#fC600
// minmax: http://old.haxe.org/doc/snip/minimax_algorithm
// negamax: http://en.wikipedia.org/wiki/Negamax
class GameMove
{
public function new()
{
@anissen
anissen / Localization Strings
Last active August 29, 2015 14:05 — forked from steverichey/Localization Strings
Danish translation of "Don't Move"
Here's a list of the strings in the game (SPOILERS kinda):
A game by: Et spil af
Powered by: Kører på
Press left or right to start: Tryk venstre eller højre for at starte
Release left and right: Slip venstre og højre
to start: for at starte
to erase: for at slette
Touch left or right side to start: Tryk venstre eller højre side for at starte
Release both sides: Slip begge sider
@anissen
anissen / gist:a0ed65bf146c7089893e
Created June 11, 2014 19:40
Haxe enum pattern matching
enum Tree<T> {
Leaf(v :T);
Node(l :Tree<T>, r :Tree<T>);
}
class Test {
static function main() {
var myTree = Node(
Leaf("foo"),
Node(