## My Toy Closet## PC RailsThis is a computerized version of Mayfair Games’ Empire Builders board game series, specifically modelled after Eurorails with its ferries, alpine mountains, and multilingual nature. Download it here. If you like to play board games but are not familiar with these games, I recommend you buy one of them from the Mayfair site. I don’t provide much background info in the download so you’ll probably want to play the board game version a couple of times first. ## Board GamesI love playing board games, especially strategy board games such as Puerto Rico as opposed to the more general-audience games like Cranium. A great site to try BoardGameGeek if you like board games. There you’ll find a list of most of the games that I own. ## Graph PaperVisual Basic program to print graph paper. It can print regular graph paper with squares, hexagonal graph paper for gaming, or isometric (with triangles). You can specify the grid size either in metric or English units. Executable (requires VB runtime) Source code ## 3D Strange AttractorsC# program to generate random 3D chaotic strange attractors. These weird shapes represent the fractal basin of attraction of a non-linear function. Find out more about strange attractors here, here, and here. Executable (requires .NET) Source code ## Maze GeneratorThis is a simple Visual Basic program that generates mazes with four different levels of difficulty, for display or for printing. Source code demonstrates basic maze generation algorithm and shows how to print in Visual Basic. Executable (requires VB runtime) Source code ## PlanetsThis is source code for a VB demo program. It simulates a number of sub-planetary masses orbiting a central solar mass. Initially the orbits are very unstable due to the random starting velocities, and many collisions result. Eventually the simulation settles down to two or three large planets in nearly circular orbits, with perhaps a planet in a distant eccentric orbit. ## Plasma 2004A 15th anniversary update to my original Plasma program. This one is C# source code only (no executable). It uses a physical simulation model instead of a mid-point displacement fractal, so it's a lot more computationally heavy that the old Plasma, but it's still fun to look at. ## Rubik's Cube Object ModelThis C# class represents a Rubik's cube (standard 3x3x3) and allows you to rotate any of its faces, reset it to its original state, perform a sequence of moves described by a string, perform the moves in reverse order, and scramble the cube. It does not solve a scrambled cube. I've tried many methods of representing a cube in software, some more cumbersome than others. This one is very simple, lightweight, and pretty fast. It uses the U, F, R, D, B, L notation for faces, and +, -, and 2 for quarter CW, quarter CCW, and 180-degree turns. So "F2 D- B2 U+" would be an example of a valid move sequence. |
## Software Development Topics## RPN CalculatorI created this calculator as my personal replacement for the Windows calculator. It's modelled after a Hewlett-Packard HP-10C calculator, and as such it uses reverse polish notation for data entry. ## Travelling SalesmanThis C# project is a quick-and-dirty Travelling Salesman Problem solver which works pretty well for several hundred nodes. It allows you to define any vertex data type and specify an arbitrary cost function to calculate the cost of an edge between two vertices. In addition to the generic solver class, some sample source code is provided to show how to use the TSP solver for points on a sphere, and a Windows Forms app is include to provide a graphical illustration of a 2D Euclidean problem as it is being solved. ## Hash Function EvaluationThis is a long article about testing 32-bit hash functions, and includes testing for uniform distribution of output bits and for diffusion of input bits into all output bit positions. I evaluate a number of different 32-bit hash functions using these tests, and provide an improvement to the FNV hash. ## SHA-1 Cryptographic HashC++ source code for a SHA-1 class. This implementation is a bit different than others because it allows you to calculate the hash result part-way through a stream and then accumulate additional data. ## ICustomFormatter InterfaceThis C# sample code illustrates how to write your own ICustomFormatter object for .NET. ## Jalali CalendarThis is my attempt at creating a .NET-compatible class for the Jalali (Persian) calendar. Written in C#. One user reported an error in the date calculations so it's not quite right yet, but I didn't know enough about the Jalali calendar to fix it. ## Random Shuffle with O(1) Memory RequirementLet's say you want to generate one million random numbers, each number being from one to one million, but you only want to use each number once and exactly once. Most algorithms for this require at least one million bits of memory to keep track of which numbers have already been generated in order to avoid using the same number twice. This C# source code demonstrates a way to do this with no need to keep track of which numbers have already been generated. It purposely uses a "bad" random number generator (a linear congruential generator) because of ability to create an LCG with a known period.
The down-side to this method is that not all possible permutatations can
be generated. Instead of n! different permutations, this algorithm can
only produce O(n ## .NET Custom AttributesThis C# sample code illustrates how to create and use custom attributes in .NET. The code includes a class called LabelAttribute that allows you to assign an arbitrary text label to any .NET code element and to read the value of that label at run-time. ## Calculate Many Digits of PiC# source code to calculate p to many digits of accuracy. Number of digits is specified as a program constant. It's not the fastest code in the world, but it'll do 10000 digits pretty quickly. |

Copyright © 2007 Bret Mulvey. All Rights Reserved.