Skip to content

Instantly share code, notes, and snippets.

@jamis
jamis / recursive-backtracker2.rb
Created Dec 27, 2010
An implementation of the recursive backtracking algorithm that *gasp* actually uses recursion.
View recursive-backtracker2.rb
# --------------------------------------------------------------------
# Recursive backtracking algorithm for maze generation. Requires that
# the entire maze be stored in memory, but is quite fast, easy to
# learn and implement, and (with a few tweaks) gives fairly good mazes.
# Can also be customized in a variety of ways.
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# 1. Allow the maze to be customized via command-line parameters
# --------------------------------------------------------------------
@jamis
jamis / Easy Marshmallow Recipe
Created Dec 10, 2009
Easy Gourmet Marshmallows
View Easy Marshmallow Recipe
EASY MARSHMALLOWS
-----------------
Marshmallows are perhaps one of the simplest confections you can make. They only
require a handful of ingredients, a batch can be thrown together in 10-15 minutes
(plus *cough* 3 hours for them to set), and you can flavor them however you like.
(You haven't LIVED until you've had coconut marshmallows!)
Hardware needed:
@jamis
jamis / Basic Baechu Kimchi
Last active May 23, 2020
Basic Baechu Kimchi
View Basic Baechu Kimchi
BASIC BAECHU KIMCHI
--------------------------------------------------------------------------
Baechu (Napa cabbage) kimchi is one of the staple foods in Korea. Spicy
and tangy, it is typically served as a side dish, with rice, but is also
found in various Korean soups and stews.
This basic version has just the fundamentals; once you're comfortable
with this version, you might try adding shredded carrots, Daikon radish,
pickled baby shrimp, or any number of other things. Search around online
@jamis
jamis / Basic Oi (Cucumber) Kimchi
Created Nov 6, 2010
Basic Oi (Cucumber) Kimchi
View Basic Oi (Cucumber) Kimchi
BASIC OI (CUCUMBER) KIMCHI
--------------------------------------------------------------------------
Oi (cucumber) kimchi is a delicious, refreshing variation on the
traditional Korean kimchi recipe.
This particular recipe is a modified version of the recipe posted by Dr.
Ben Kim, at http://www.drbenkim.com/how-to-make-cucumber-kim-chi.htm.
--------------------------------------------------------------------------
@jamis
jamis / binary-tree.rb
Created Jan 1, 2011
An implementation of the "Binary Tree" algorithm for maze generation.
View binary-tree.rb
# --------------------------------------------------------------------
# An implementation of the "Binary Tree" algorithm. This is perhaps
# the simplest of the maze generation algorithms to implement, and the
# fastest to run, but it creates heavily biased mazes.
#
# It is novel in that it can operate without any state at all; it only
# needs to look at the current cell, without regard for the rest of
# the maze (or even the rest of the row). Thus, like Eller's algorithm
# it can be used to generate mazes of infinite size.
# --------------------------------------------------------------------
@jamis
jamis / ellers.rb
Created Dec 24, 2010
An implementation of Eller's algorithm for generating mazes
View ellers.rb
# --------------------------------------------------------------------
# Eller's algorithm for maze generation. Novel in that it only
# requires memory proportional to the size of a single row; this means
# you can generate "bottomless" mazes with it, that just keep going
# and going and going, using not only constant memory, but little
# memory in general.
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# 1. Allow the maze to be customized via command-line parameters
@jamis
jamis / query-parser.rb
Last active Oct 1, 2019
A simple example of a BNF-based, recursive-descent parser for reading a field-based query string
View query-parser.rb
require 'strscan'
# expr := term
# | term AND expr
# | term OR expr
# term := value
# | atom ':' value
# atom := word+
# | quoted_string
# value := atom
@jamis
jamis / recursive-division.rb
Created Jan 1, 2011
An implementation of the "Recursive Division" algorithm for maze generation.
View recursive-division.rb
# --------------------------------------------------------------------
# An implementation of the "Recursive Division" algorithm. This is a
# kind of fractal maze algorithm, recursively dividing the maze into
# smaller and smaller cells. This algorithm stops at the integer
# boundary, but theoretically the algorithm could continue infinitely
# to smaller and smaller scales.
#
# Note that this algorithm is implemented as a "wall adder", rather
# than a "passage carver", so the meaning of the bits in each cell
# is reversed: instead of the S bit (for instance) meaning "a passage
@jamis
jamis / kruskals.rb
Created Dec 28, 2010
An implementation of Kruskal's algorithm for generating mazes.
View kruskals.rb
# --------------------------------------------------------------------
# An implementation of Kruskal's algorithm for generating mazes.
# Fairly expensive, memory-wise, as it requires memory proportional
# to the size of the entire maze, and it's not the fastest of the
# algorithms (what with all the set and edge management is has to
# do). Also, the mazes it generates tend to have a lot of very short
# dead-ends, giving the maze a kind of "spiky" look.
# --------------------------------------------------------------------
# NOTE: the display routine used in this script requires a terminal
# that supports ANSI escape sequences. Windows users, sorry. :(
@jamis
jamis / Whole Wheat Bread Recipe.txt
Last active Mar 19, 2019
Jamis' recipe for homemade whole wheat bread
View Whole Wheat Bread Recipe.txt
Jamis' Whole Wheat Bread
Ingredients
(Pardon the mixed metric/imperial units. I'm a product of my time.)
450 g warm water
450 g milk
1 tbl apple cider vinegar
1 tbl shortening
You can’t perform that action at this time.