# snippet

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 …

## 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 with worms

Growing on the idea from a previous post on making a cave-like structure, this is a different algorithm which makes use of worms / miners to dig out the initial level layout from the rock layer. Thereafter fun things are done to the level to make it look nicer. For example: …

## 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” …

## Code Snippet: Generate Checkerboard Pattern

Pure solid backgrounds are getting just a little too plain for me of late. The alternative is to provide a pattern. Now you can use an image- where the size of the background determines the file size (not cool) or you could just procedurally generate one (file size determined by …

## Code Snippet: Collision Detection

This bit of code uses blend modes to determine if two display objects intersect (if they are overlapping). It takes into account transparency, rotation, scale and translation. It enables near pixel level overlay detection. This forms the first part of any collision detection algorithm, firstly finding out if two objects …