Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / recursive-backtracker.rb
Created Dec 24, 2010
Implementation of the recursive backtracking algorithm for maze generation
View recursive-backtracker.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.
DIRS = (N, S, E, W = 1, 2, 4, 8)
DX = { E => 1, W => -1, N => 0, S => 0 }
DY = { E => 0, W => 0, N => -1, S => 1 }
OPPOSITE = { E => W, W => E, N => S, S => N }
@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 / 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 / prims.rb
Created Dec 31, 2010
An implementation of Prim's algorithm for generating mazes.
View prims.rb
# --------------------------------------------------------------------
# An implementation of Prim's algorithm for generating mazes.
# This is a pretty fast algorithm, when implemented well, since it
# only needs random access to the list of frontier cells. It does
# require space proportional to the size of the maze, but even worse-
# case, it won't be but a fraction of the size of the maze itself.
# As with Kruskal's, this algorithm tends to generate mazes with many
# short cul-de-sacs.
# --------------------------------------------------------------------
# NOTE: the display routine used in this script requires a terminal
@jamis
jamis / aldous-broder.rb
Created Dec 31, 2010
An implementation of the Aldous-Broder algorithm for generating mazes.
View aldous-broder.rb
# --------------------------------------------------------------------
# An implementation of Aldous-Broder's algorithm for generating mazes.
# This is an easy one to implement, but it is also one of the
# "dumbest" (meaning least intelligent) algorithms. It is not even
# guaranteed to finish, if you get really unlucky with the RNG.
# Watching the animation of its progress can be an exercise in
# frustration as you find yourself urging the cursor to JUST GO
# OVER THERE! Try and it see for yourself. :)
# --------------------------------------------------------------------
# NOTE: the display routine used in this script requires a terminal
@jamis
jamis / wilsons.rb
Created Dec 31, 2010
An implementation of Wilson's algorithm for generating mazes.
View wilsons.rb
# --------------------------------------------------------------------
# An implementation of Wilson's algorithm for generating mazes.
# Slightly smarter than Aldous-Broder, it is novel in its use of a
# "scout" to build each path before actually recording it. Like
# Aldous-Broder, though, it is not guaranteed to ever finish, if
# the RNG makes poor choices.
#
# As with Aldous-Broder, watching the animation of its progress can
# be an exercise in frustration as you find yourself urging the cursor
# to JUST GO OVER THERE! Try it and see for yourself. :)
@jamis
jamis / hunt-and-kill.rb
Created Dec 31, 2010
An implementation of the "Hunt and Kill" algorithm for generating mazes.
View hunt-and-kill.rb
# --------------------------------------------------------------------
# An implementation of the "Hunt and Kill" algorithm. This is fairly
# similar to the recursive backtracking algorithm, except that there
# is no recursion, and it doesn't backtrack. :) The algorithm can
# get a little slow towards the end, where the "hunt" phase has to
# search over nearly the entire field to find a candidate cell, but
# it's guaranteed to finish (unlike Aldous-Broder and Wilson's), and
# it's still pretty fast.
# --------------------------------------------------------------------