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
(use-modules (srfi srfi-1)) | |
(use-modules (ice-9 format)) | |
(define val cons) | |
(define stmt car) | |
(define expr cdr) | |
(define (compile x return?) | |
(cond ((number? x) (val "" (fmt "~a" x))) | |
((string? x) (val "" (fmt "~s" x))) |
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
def pairs(l): | |
return zip(l[::2], l[1::2]) | |
def vm(ops, env={}): | |
class closure: | |
def __init__(self, pc, env): self.pc, self.env = pc, env | |
def popn(n): | |
if len(stack) < n: print 'not enough elements for pop: %d needed, %d left' % (n, len(stack)) | |
top = stack[-n:] | |
stack[-n:] = [] |
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
def pairs(l): | |
return zip(l[::2], l[1::2]) | |
def vm(ops, env={}): | |
class closure: | |
def __init__(self, pc, env): self.pc, self.env = pc, env | |
def popn(n): | |
if len(stack) < n: print 'not enough elements for pop: %d needed, %d left' % (n, len(stack)) | |
top = stack[-n:] | |
stack[-n:] = [] |
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
def lex(text): | |
sym = r'[\w+\-*/=<>]+' | |
toks = ( | |
r';.*?\n\s*', | |
lambda m: None, | |
r'-?(\d+)?\.\d+(e-?\d+)?\s*', | |
lambda m: ['val', float(m.group(0))], | |
r'-?\d+\s*', | |
lambda m: ['val', int(m.group(0))], | |
r"'((?:[^'\\]|\\.)*)'\s*", |
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
using System; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Linq; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
// https://www.microsoft.com/en-us/research/wp-content/uploads/2004/12/tr-2004-136.pdf |
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
Sid Meier's 10 Rules of Game Design | |
1. Choose a topic you have a passion for. Game Design is about creativity. | |
2. Do research after the game is done. Tap into the player’s brain. | |
3. Define your axioms, refine your axioms. Prototype, prototype, prototype; sit in all the chairs. | |
4. Double it or cut it in half. You are more wrong than you think. |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using Priority_Queue; | |
internal class Program | |
{ | |
private const int infinity = 999; |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Newtonsoft.Json; | |
[JsonObject(MemberSerialization.OptIn)] | |
public class CircularStack<T> | |
{ | |
[JsonProperty] public int maxVirtualCount; |
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
using System.Collections.Generic; | |
using System.Linq; | |
using UnityEngine; | |
public class Pool<T> where T : Component, ISpawnable | |
{ | |
public HashSet<T> freeInstances = new HashSet<T>(); | |
public Transform parent; | |
public T prefab; |
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
using System; | |
using System.Collections.Generic; | |
public static class Observers | |
{ | |
public static Dictionary<int, HashSet<Action>> observers = new Dictionary<int, HashSet<Action>>(); | |
public static List<Action> list = new List<Action>(); | |
public static void Notify(int entityId) | |
{ |
OlderNewer