Skip to content

Instantly share code, notes, and snippets.

@Descalon
Descalon / lalg2e.tex
Created March 4, 2014 15:46
Latex algorithm2e usage
\usepackage[lined,boxed]{algorithm2e} %preamble
%algorithm usage
\begin{algorithm}
\KwIn{entities; actors; player; customRules;}
\KwOut{new world state}
let \textit{entities} be all entities, excluding actors and the player\;
let \textit{actors} be all actors, including the player\;
\ForEach{actor in actors}{
actor.rules.Invoke()\;
@Descalon
Descalon / MeshExtruder.cs
Created July 18, 2013 08:09
Unity Mesh Extruder found on Google Code
using UnityEngine;
using System.Collections;
/*
* An algorithm to extrude an arbitrary mesh along a number of sections.
The mesh extrusion has 2 steps:
1. Extracting an edge representation from an arbitrary mesh
- A general edge extraction algorithm is employed. (Same algorithm as traditionally used for stencil shadows) Once all unique edges are found, all edges that connect to only one triangle are extracted.
@Descalon
Descalon / OneLineFizzBuzz.cs
Last active December 19, 2015 12:19
Nice FizzBuzz one liner.
public class Program {
static void Main(string[] args) {
string s;
for (int i = 1; i < 100; i++) {
s = (i % 15 == 0) ? "FizzBuzz" :(i % 3 == 0) ? "Fizz" : (i % 5 == 0) ? "Buzz" : i.ToString();
System.Console.WriteLine(s); //LOG
}
}
}
@Descalon
Descalon / fizzbuzz.cs
Last active December 19, 2015 12:19 — forked from JeremyMorgan/fizzbuzz.cs
My most compact, sensible and readable answer to the FizzBuzz problem.
using System;
namespace CrapTester_vs10 {
public class Program {
static void Main(string[] args) {
string s;
for (int i = 1; i < 100; i++) {
s = "";
if (i % 3 == 0)
s += "Fizz";
if (i % 5 == 0)
@Descalon
Descalon / FindChildren.cpp
Last active December 12, 2015 07:48
Trying to find a binary tree in a Delaunay graph. This must be pretty inefficient.
bool findChildren(Center* root, Center* dNeighbour, float depth){
if(depth < 0) return false;
vector<vector<Center*>> checkLists;
vector<Center*> check;
if(dNeighbour != nullptr){
check = findSharedNodes(root, dNeighbour);
checkLists.push_back(check);
}
Center* c1, * c2;