rubik-cipher
Version:
Simple rubik cube cipher
67 lines (66 loc) • 2.11 kB
TypeScript
import { RubikCipherConfig, ScrambleObject } from './RubikCipherInterfaces';
declare class RubikCipher {
private text;
private cube;
private currentScramble;
private size;
private groupSize;
private fillRest;
private fillWithRandom;
private fillAlphabet;
/**
* Key constructor (Usually used when decoding)
* @param {string} text Ciphre text
* @param {string} config Cipthre key
*/
constructor(text: string, config?: string);
/**
* Config constructor (Usually used when encoding)
* @param {string} text Ciphre text
* @param {RubikCipherConfig} config Ciphre config object
*/
constructor(text: string, config?: RubikCipherConfig);
private setupFromKey;
private isValidKey;
private getKeyParts;
private combinationTextToObject;
private applyReverseCombination;
/**
* Function for cube scrambling
* @param {number} count How many times you want to scramble
*/
scramble(count?: number): void;
/**
* Function for additional cube scrambling
* @param {number} count How many times you want to scramble
*/
addScramble(count?: number): void;
/**
* Function to manually turn the cube
* @param {string | Array<ScrambleObject>} turnKey selected sequence of turns
*/
turn(turnKey: string | Array<ScrambleObject>): void;
/**
* Reset the cube or create new one when cube is undefined
*/
reset(): void;
/**
* Getter for current cube Combination string
* @returns {string}
*/
readonly Combination: string;
readonly InverseCombination: ScrambleObject[];
/**
* Getter for current text from cube stickers
* @returns {string}
*/
readonly Text: string;
readonly Indexes: number[];
/**
* Gets current cube key in format size+groupSize+fillRest(0 or 1)+fillRandom(0 or 1)+combination
* @returns {string} key
*/
readonly Key: string;
readonly CubeTileCount: number;
}
export = RubikCipher;