ts-hashlife
Version:
Efficient TypeScript implementation of HashLife, an optimized algorithm for simulating Conway's Game of Life with memoization and quadtree-based compression.
42 lines (41 loc) • 1.25 kB
TypeScript
export interface Pattern {
title: string;
description: string;
source_url: string;
view_url: string;
urls: string[];
rule?: string;
author?: string;
}
export interface Result {
comment: string;
urls: string[];
title?: string;
author?: string;
rule?: string;
pattern_string?: string;
width?: number;
height?: number;
rule_s?: number;
rule_b?: number;
field_x?: Int32Array | number[];
field_y?: Int32Array | number[];
error?: string;
}
declare function parse_rle(pattern_string: string): Result;
declare function parse_comments(pattern_string: string, comment_char: string): Result;
declare function parse_rule(rule_str: string, survived: boolean): number;
declare function rule2str(rule_s: number, rule_b: number): string;
declare function generate_rle(life: any, name: string, comments: string[]): string;
declare function parse_pattern(pattern_text: string): Partial<Result> | {
error: string;
};
export declare const formats: {
parse_rle: typeof parse_rle;
parse_pattern: typeof parse_pattern;
rule2str: typeof rule2str;
parse_rule: typeof parse_rule;
parse_comments: typeof parse_comments;
generate_rle: typeof generate_rle;
};
export {};