

_k_tuples() - Generates an array of all possible base- b k-tuples, in ascending (or descending) order.This is the inverse of _natural_to_integer(). _integer_to_natural() - Maps an integer to a unique natural number using the zig-zagging bijection from (0, 1, -1, 2, -2.This is the inverse of _natural_to_integer_pair(). _integer_pair_to_natural() - Maps an ordered pair of integers to a unique natural number (by composing _nautral_pair_to_natural() on _integer_to_natural())._frac() - Generalized fractional part function which accepts a step size argument._floor() - Generalized floor function which accepts a step size argument._factorial() - Calculates the factorial ( n!) of a nonnegative integer._decimal_to_base() - Converts a number from decimal to an array of base- b digits.


_base_to_decimal() - Converts a number from an array of base- b digits to decimal.For example, the various pairing and inverse pairing functions can be used to store pairs of numbers as single numbers in data structures (like stacks and queues) and then recovered. The following is a brief description of the included functions, divided into rough categories.Ī variety of scripts dealing with sequences, functions, and sets, which may have some uses for managing data structures. The scripts included in the package are reasonably well-documented within the source code. Some include methods, which are always defined in the object's Create event. All object names begin with the obj_ prefix. All function names begin with an underscore in order to distinguish them from built-in functions. Most functions are standalone and are meant to be taken à la carte, but some of the more mathematically complicated functions depend on other scripts, indicated in a tag. I encourage you to download it, use it in your own projects, and modify the source code as much as you like.Įach script in this package defines a single function. I've written these functions for my own use over the years, and I expect to add more over time.Īll source code is available for free at my GitHub page, released under the MIT license. This is collection of general utility and mathematical objects and functions for GameMaker Studio 2 (Version 2.3) in the form of a local asset package.
