# Code Snippets

I keep running across the incorrectly named invader “fractal”. I originally saw the invader fractal on levitated, created by Jared Tarbell. Shortly after I noticed it at complexification, also Jared. There are also some sketches on openprocessing.org. It was in large part to seeing a lot of these lately that …

## Urquhart Graph

In computational geometry, the Urquhart graph of a set of points in the plane, named after Roderick B. Urquhart, is obtained by removing the longest edge from each triangle in the Delaunay triangulation. Using the as3delaunay library to generate the triangulation, I then proceeded to remove the longest edge from each triangle to create the Urquhart graph. I …

## Old CRT Monitor Effect

Does anyone remember the first CRT monitors? Those monochrome ones that had the ugly refresh line, scanlines, etc. This is an attempt to recreate that feel. I got the idea from tutsplus.com. Actually I used the method there almost exactly and changed the image. This effect makes use of RGB …

## Trippy RGBShifting Effect

Have you ever seen those old effects where an image does not quite look right and is a bit off colour. It can be best described as looking trippy. This effect is achieved by shifting the RGB colour layers that make up an image. It reminds me of a really …

## Voronoi Dungeon Generator

Continuing from the previous post on irregular shaped room generation. The idea is to make use of multiple rooms to create a dungeon. A room’s connectedness is determined by calculating a minimum spanning tree on a delaunay triangulation using a voronoi diagram from the as3-delaunay library. This ensures that all rooms are …

## Irregular Shaped Rooms / Caves

I was looking at procedural dungeon generation and found a link on how to generate irregular shaped rooms which can be included in dungeon generation. The idea is to reduce the repetition of square rooms and give a more natural look to the dungeon. I decided to implement the algorithm …

## Making a cave-like structure

There are a lot of tutorials on the net that make use of cellular automata to generate cave-like structures. Cellular automata are easy to program and I found a C & C# implementation which I used as a base for this method. The relevant method to generate the cave is …

## Dice Distributions

To generate random numbers that follow a certain distribution you can generate them using the formula of the distribution. This is great if you have a distribution which is in polynomial form. Another way to get such a distribution is to make use of dice. I know what the distribution …

## Preventing calls to System.exit in Java

Java command line tools can be run from within a Java program. The benefit in doing this is that you can automate command line functionality from within Java code. This is great when you do not have things like ant and maven support and if you are running the “command” …