User:BoundedBeans/My Funge-98 fingerprints

From Esolang
Jump to navigation Jump to search

This is a list of custom Funge-98 fingerprint specifications made by User:BoundedBeans. They are currently all unimplemented.

FARM

Bitstring: 0x4641524D

This fingerprint provides an alternate way of creating large amounts of threads.

Farm

A farm is a 2d structure in funge-space pointed to by a vector. The vector should point to an opening square bracket ([) (otherwise commands will reflect). Search to the right until a closing square bracket (]) is found (it should not wrap, if it does, the command will reflect). Then search downwards until one or both of the columns originally containing a square bracket do not contain a square bracket at that row, or if the end of funge-space bounds is reached (in Unefunge, farms may only have one row). Between the square brackets, spaces and digits can be contained. Anything else is treated as a space. Farms have a width and height max of 64 cells (not including the square brackets). If the search for the closing bracket exceeds 65 tiles, the command will reflect. If the downward bound search exceeds 64 tiles, the farm will simply end there.

Instructions

Command Stack effect Semantics
C (vsz vfarm -- ) Pops a position vector and a size vector, creates a new farm there. The size vector should always be 2d (in Unefunge the y element should always be zero).
H (delta vfarm -- ) Pops a position vector an a delta vector, followed by a cell n, followed by n cells. All 9's in the pointed to farm will become new ips. (If there are no 9's, this command reflects). In standard English reading order, each one will acquire the delta, traveling until it hits a valid semicolon (;), which it will temporarily mark as invalid so that ips on the same delta path won't start at the same point. The semicolon's position plus the delta is that ip's initial condition and the delta is the ip's initial delta. The ip is empty (unlike t), equivalent to the ip at the start of the program but with a different position and delta, except it has the vector to its parent farm pushed to its stack, followed by its initial position within the farm (1-based, not including square brackets) as a 2d vector. After all ips have initialized, the semicolon markings are reset. All of that happens in one tick. One potential way of easily transferring data to the new ips is to put some data in funge-space around the farm. The ips are after all other ips in a tick, in standard English reading order of their original positions in the farm.
P (n vfarm -- ) All spaces in the pointed to farm will be replaced with either 0 or 1, depending on the bit pattern of n, repeating in standard English reading order.
Q (vpos vfarm -- n) Pops a farm pointer vector, pops a (1-based, not including square brackets) position within the farm, pushes the digit as a number (not as a character). If space or other non-digit, pushes -1.
S (vfarm -- vsize) Pops a farm pointer vector, pushes the size of the farm as a vector.
W (vfarm -- ) All digits in the pointed to farm will be incremented by 1, except if it is 9, which won't.
X (args CMD -- result) Equivalent to: pop letter (call it c), push (position + delta) to stack, run fingerprint command c, run command [ (turn left). Note that if c reflects, it will effectively turn right. This command will really mess up if the ips delta puts you into the farm. Recommended you only use this command while moving right or down, or if the delta has a non-zero z element. This command is available in Unefunge, but doesn't turn left at the end. It will then touch the square brackets enclosing the farm, which will reflect the ip. Command failure also reflects, so to tell whether the command failed you'll have to manually inspect the farm (perhaps using Q).

FOEA

Bitstring: 0x464f4541

This fingerprint contains various for-each block constructs. There is a per-ip storage containing a stack of for-each data units. A unit contains a vector for the start of the block, a vector for the end of the block, a vector for the start of the rectangle Funge-space to be iterated over, a vector for the size of that rectangle, and a vector for the current position within the iterated rectangle. There is also a per-ip boolean, which marks whether S should start a new for-each loop or continue the existing one.

Instructions

Letter Stack effect Semantics
B ( - ) Jump to the E, break out of the loop, pop an entry from the for-each stack, set the boolean to true.
C ( - ) Acts exactly like E, but isn’t marked specially (functions as a continue statement).
E ( - ) Increments the current position of the iterative rectangle, sets the boolean to false (if it is at the end of x, increments y; if it is at the end of y, increments z; if at the end of z, doesn’t jump back, pops the top entry from the for-each stack, and sets the boolean to true); jumps back to the position of the for-each start on the stack (the S), sets the direction to right, and moves one cell backwards so that the command executed next is S.
S (Vsize Vpos Vend - c)

If the boolean is true: Pops a vector for the end of the loop block (there should be an E instruction at that coordinate, otherwise this will act like r) (mainly useful for the B instruction), pops a vector for the lowest position of the rectangle to iterate over, and pops a vector for the size of the rectangle. Pushes this information to the for-each stack, along with its own coordinate. Regardless: Pushes the current cell in the iterative rectangle onto the stack. Sets the boolean to true. Sets the direction to right.

G_ar

Bitstring: 0x475f6172

This fingerprint allows execution of G_arD^EN CorUtY@rD programs from inside funges.

It's possible that in certain environments, certain commands may be impossible to implement. In that case, running them should reflect, and the unimplemented commands should be documented in I.

Instructions

Command Stack effect Semantics
A (v? 0gnirts V[2d] -- ) Pops a 2d size vector (no matter what dimensionality the funge has) and a string for the name. Allocates a new G_arD^EN CorUtY@rD program space with the given name. All of it is allocated with ground bricks (#). If it is already allocated, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack.
B (v? v 0gnirts[program name] 0gnirts[breakpoint name] V[2d] -- ) Pops a 2d vector, followed by two string names, followed by a vector. Sets a breakpoint with the name. When the programs gets to those coordinates, it will save the state and run the Funge code at the second vector. The ip's original coordinates, followed by its original delta, are pushed onto the SOSS. The program's name, followed by the breakpoint's name, followed by the queue in usual format, followed by the command queue (terminated by a null character), followed by the input queue, followed by the output queue, will be pushed onto the TOSS. It can return with U (as with V interruptions). E or F can then be used to continue running it. [Back to the command's immediate functionality]. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack.
C ( -- ) clear all program spaces.
D (v? 0gnirts -- ) Deallocates the space with the name. This is required to re-size a program. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack.
E (v? 0gnirts qi -- qo) Pops a series of character cells equal to either lowercase x (0) or uppercase X (1), terminated by an uppercase K, then pops a string for the name. Executes the program until the queue is empty (in 1 tick total with the rest of this command) with input as the popped queue (input by the table), pushes an uppercase K, followed by all of the output bits (outputted by the grill) as lowercase x (0) or uppercase X (1) in reverse order. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack. The same thing happens if the program encounters an invalid command, but instead pushes the command, followed by 1. The same thing happens if the input queue is used when empty, but instead pushes 2. The same thing happens if the input queue contains an invalid character, but pushes the character, followed by 3.
F (v? 0gnirts qi bool -- qo) Similar to E, but stops executing once it goes off the edge rather than restarting at the chair. Also pops a cell, if 1, it also changes the initial queue to match the queue ended with (effectively allowing you to run it again to continue).
G (v? 0gnirts v[2d] -- c) Pops a vector, then a string for the name, pushes the character at that named program at the vector. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack. The same thing happens if the vector is out of bounds, except the vector, followed by a 1 is pushed.
H (v? 0gnirts vs vd -- ) Pops a vector for the destination, then a vector for size limitations, then a string for the name, puts the contents of the named program into fungespace. If the program is in Unefunge, writes the program in standard english reading order. Fungespace will not be written to more than the size limitations. If any one of the size limitation vector elements is negative, it will run with no size restrictions. Otherwise, if one of the elements is zero, it will not write anything. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack.
I (n -- ...) Kind of like y, but different (selects the entire element, not individual cells).
  1. A number with the least significant bit representing A, and 25 more significant bits up to Z. This represents what commands are supported. If the funge has 16-bit or 8-bit cells, it will push 2 or 4 cells.
  2. The count of program spaces.
  3. 0 if program spaces are per-ip, 1 if they are completely global, and 2 if they are per-vm (when FOBJ, MVRS, or something else of the sort is used). You can also use -1 if the implementation doesn't have any way to know.
  4. The number of extensions/modifications supported in this fingerprint.
  5. A list of extensions/modifications supported in this fingerprint. Each should be a single cell (or 2 or 4 cells if the funge variant has less bits).
  6. The number of program spaces.
  7. A list of null-terminated strings of the names of program spaces.
K (v? 0gnirts -- q) Pops a string for the name, pushes a queue of bits as lowercase x (0) or uppercase X (1), terminated by a uppercase K, that is the initial queue. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack.
Q (v? 0gnirts q -- ) Pops a series of character cells equal to either lowercase x (0) or uppercase X (1), terminated by a uppercase K, then pops a string for the name. Resets the initial queue, then enqueues the bits in the order they were popped. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack. The same thing happens if the queue contains an invalid character, but pushes the character, followed by 1.
S (v? 0gnirts -- ) Pops a string for the name, toggles asynchronous mode for the named program. In asynchronous mode, other ips can run while a GC program is executing, and each GC command takes one tick. The ip which called E or F is stopped during execution. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack.
U ( -- ) Pops the top stack off of the stack stack. Pops a delta off the new TOSS, followed by coordinates. Teleports to those coordinates, with the delta. Useful for returning to normal control after it is teleported away by the effects of V.
V (v? 0gnirts v -- ) Pops a vector v, pops a string for the name. When the name finishes executing, the ip that executed this command is teleported to the vector, the direction set to right, and a new stack is pushed onto the stack stack. The ip's original coordinates, followed by its original delta, are pushed onto the SOSS. The name of the program, followed by a 2d vector for the final GC ip position, followed by (the command followed by 1 if the program encountered an invalid command, 2 if the program encountered EOF, 0 if it was successful), followed by (1 if asynchronous, 0 otherwise), followed by ('E' or 'F' depending on the command that started it), is pushed onto the TOSS. [Back to the command's immediate functionality]. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack.
W (v? 0gnirts[name] 0gnirts[contents] V[2d] -- ) Pops a 2d vector, a contents string, and a name string. Writes the contents to the program space assigned to the name starting at the (0-based) vector coordinates in standard English reading order, wrapping. Note that the initial queue state cannot be written to, that must be done with Q. If the given space doesn't exist, pops a vector, teleports the ip to its position (retaining the current delta), and pushes 0 to its stack. The same thing happens if the vector is out of bounds, but pushes 1.
X (action -- n) If action is 0, acts like (. If action is 1, acts like ). (Both with a separate registry of fingerprints that are specialized as extensions for this fingerprint.) If action is 2, builds a fingerprint number like (, then runs a special extension-wide command which depends on the extension (probably using an argument to figure out what to do). Extensions of the form 0x40------ ("@xxx") are reserved for revisions.

GENE

Bitstring: 0x47454E45

IP genetics for multithreading.

Local IP data

Each IP contains a few extra pieces of local data:

  • The Y Chromosome (stores data from the male partner while pregnant, to pass to the child)
  • Pregnancy Time (if zero, they are not pregnant. If it one and G is executed, the ip will give birth.)

Instructions

Command Stack effect Semantics
P ( -- n) Returns the current ip's pregnancy time.
W ( -- ) If pregnancy time is one, the ip will give birth. Decrements pregnancy time by one.
X ( -- ) If an ip goes on this cell and it is the only one, it will wait on that cell. If an ip goes on this cell and there is exactly one other ip on that cell, a random one of the two will become pregnant and the one waiting will be freed, retaining its delta from before it entered this cell. Note that both ips must have the PREG fingerprint enabled, otherwise they won't act out their respective behaviors on this cell. If there are more than two ips on this cell, it is a no-op, acting similarly to z.

When an ip becomes pregnant, it gets a pregnancy time of 270 (days, or 9 months).

Genetics

The child ip will have the following attributes:

  • The TOSS of the mother at birth on top of the stack, and the TOSS of the father at conception below. The rest of the stack stack consists of the father's at conception on top of the mother's at birth.
  • The position will be of the mother.
  • The delta will be (-current mother dx, -father dy at conception, -((mother dz at birth)*(father dz at conception))
  • The storage offset will be (father storage offset x at conception, mother storage offset y at birth, father soz at conception + mother storage offset z at birth)
  • The delta and storage offset are of course truncated to fit in unefunge or befunge.
  • If a higher dimensional funge is used, the rest of the dimensions in the delta and storage offset are filled with zeros
  • No fingerprints are loaded onto the baby

GRPH

Bitstring: 0x47525048

This fingerprint is a graphing calculator in Funge-space. There is a per-ip storage containing a list of current expressions.

Instructions

Command Stack effect Semantics
A (a -- ) Set currently selected expression.
B (a b -- ) Sets currently selected expression to expression a + expression b
C (a b -- ) Sets currently selected expression to expression a - expression b
D (a b -- ) Sets currently selected expression to expression a * expression b
E (a b -- ) Sets currently selected expression to expression a / expression b
F (c -- ) Sets currently selected expression to a constant accepted as a single-precision float
G ( -- ) Sets currently selected expression to x.
H ( -- ) Sets currently selected expression to y.
I (a -- ) Sets currently selected expression to abs(expression)
J (a m t -- ) Sets currently selected expression to:
  • If t = 0: sin(expression a)
  • If t = 1: cos(expression a)
  • If t = 2: tan(expression a)
  • If t = 3: sec(expression a)
  • If t = 4: csc(expression a)
  • If t = 5: cot(expression a)
  • If 6 < t < 11: The inverse of the function denoted by t - 6
  • If t = 12: (expression a) == 0 ? 0 : 1
    • This allows boolean functions:
NOT a    = 1 - a
a AND b  = a * b
a OR b   = bool(a + b)
a XOR b  = bool((a * (1 - b)) + ((1 - a) * b))
  • If m = 1: Use radians, otherwise use degrees.
K (a b -- ) Sets currently selected expression to expression a ^ expression b
L (a b -- ) Sets currently selected expression to (log base expression a)(expression b)
M (lowybound lowxbound highybound highxbound widthOfCellY widthOfCellX a b -- ) Graphs expression a = expression b. Everything other than b is a single-precision float. If funge-space is Unefunge, does it row by row, going right.
N (lowzbound lowybound lowxbound highzbound highybound highxbound widthOfCellZ widthOfCellY widthOfCellX a b c -- ) Does a 3d graph with similar qualities to M. If funge-space is Befunge, does it slice by slice, going down. If funge-space is Unefunge, does it row by row, then slice by slice, going right.
O ( -- ) Sets currently selected expression to z.
P ( -- ) Sets currently selected expression to pi
Q ( -- ) Sets currently selected expression to e
R ( -- ) Sets currently selected expression to the golden ratio
S (lowybound lowxbound highybound highxbound widthOfCellY widthOfCellX a b -- ) Like M but doesn't store and instead prints to stdout.
T (lowzbound lowybound lowxbound highzbound highybound highxbound widthOfCellZ widthOfCellY widthOfCellX a b c -- ) Like N but doesn't store and instead prints to stdout.

You can make a sqrt(x) with x^(1/2)

Graphing

The graph is stored in Funge-space as spaces = false and '@' = true, with x = lowxbound y = lowybound z = lowzbound located at the storage offset and going to the right, down, and whatever the delta 0x 0y 1z represents. The graph should not have any interpolation or smoothing.

SUGU

Bitstring: 0x53554755

This fingerprint is for executing Sugueziume code inside Funge-98. There is a per-ip storage containing a queue of strings, a currently executing string, and an instruction pointer to the currently executing string, which resets back to zero when the current string finishes executing.

Instructions

Letter Stack effect Semantics
C (n - ) Pops a cell. If nonzero: Clears the queue. If zero: Deletes the currently executing string.
E (0gnirts[input] - 0gnirts[output]) Execute until the queue is empty. Both input and output are comma-separated strings.
F (0gnirts - ) Breaks typical queue fashion and inserts the strings (comma-separated) at the front. (They can be executed by S to run operations on the queue.)
P (n - 0gnirts) Pops a cell. If nonzero: Copies the queue, pushes it as a string onto the stack, elements separated by commas. If zero: Pushes the currently executing string onto the stack.
Q (0gnirts - ) Pops a string off of the stack, enqueues the comma-delimited substrings one by one into the queue of strings. Characters that are not commas, spaces, or uppercase letters are ignored.
S ( - ) Execute the entire currently executing string.
X ( - ) Execute one instruction in the currently executing string.

Note: When X or S finishes the currently executing string, another will be dequeued and made the new current string.

TMLT

Bitstring: 0x544d4c54

This fingerprint enables true multithreading, where blocking operations don't stop the entire program.

Instructions

Command Stack effect Semantics
F (0gnirts... n -- ) Starts new threads with all of the file names as separate funge spaces, able to communicate with the main program via files. The original ips from this program continue to run.
G ((x2 y2 z2 x1 y1 z1)... n -- -1 bytes) Defines the bounds of programs in funge-space, multithreads them as if they were files (it's okay if they create temporary files to store them), behaves similarly to F. However, any modifications to funge-space in the programs also modifies the corresponding cell in the calling program, but only in the specified bounds. The same also happens when the calling program does it in the other direction.
Q ( -- b b b) Pushes 1 if T is supported, otherwise 0, then pushes 1 if F is supported, otherwise 0, then pushes 1 if G is supported, otherwise 0.
T (sox soy dx2 dy2 dz2 x2 y2 z2 dx1 dy1 dz1 x1 y1 z1 -- ) This blocks all other ips from running, and creates two ips of a different nature which run at the same time rather than taking turns. The new ips' stack stacks, modes, and fingerprint stacks are copied from the original, while the storage offsets are popped by this command.