Routines
This page is a collection of short routines that can be used as subroutines in larger programs. By contrast, the Sample Programs page links to entire games (that may use some of these routines). Technique Examples contains yet a third type of program — short programs that may be of some value by themselves, but are present here mainly to demonstrate the use of some programming technique in an actual program.
When contributing routines, please follow these guidelines:
- A routine should be self-contained, and relatively short in length.
- A routine should be thoroughly tested to make sure it works correctly.
- Include inc:routine as the starting point for pages.
- When the routine page is finished, link to it from here.
- First Non-Zero Element — Finds the first nonzero element in a list.
- List Search — Returns the first occurrence of an element in a list, or 0 if it wasn't found.
- List Frequency — Finds the frequency of values in a list.