function GET_NEXT_LEVEL(PREV_LEVEL:string[]) {
return JSON.stringify((function (R, P:string[]) {
let O = new Array<string>();
P.forEach(A => { R.get(A.at(-1))?.forEach(B => { O.push(`${A}${B}`)})});
return O ?? [''];
})((
new Map<PER1, PER1[]>([
[ "P", [ "P","F","M", "G","B","Z", "C","S","D", "E" ] ],
[ "F", [ "P","F","M", "G","B","Z", "C","S","D", "W" ] ],
[ "M", [ "P","F","M", "G","B","Z", "C","S","D", "H" ] ],
[ "G", [ "C","S","D", "E" ] ],
[ "B", [ "C","S","D", "W" ] ],
[ "Z", [ "C","S","D", "H" ] ],
[ "C", [ "C","S","D", "E" ] ],
[ "S", [ "C","S","D", "W" ] ],
[ "D", [ "C","S","D", "H" ] ],
[ "E", [ "P","F","M", "G","B","Z", "C","S","D", "E" ] ],
[ "H", [ "P","F","M", "G","B","Z", "C","S","D", "W" ] ],
[ "W", [ "P","F","M", "G","B","Z", "C","S","D", "H" ] ]
])
),PREV_LEVEL));
}
type PER1 = "P" | "F" | "M" | "G" | "B" | "Z" | "C" | "S" | "D" | "E" | "H" | "W";
const REZ1:PER1[] = [ "P", "F", "M", "G", "B", "Z", "C", "S", "D", "E", "H", "W" ];
const REZ2 = GET_NEXT_LEVEL(REZ1);
console.log(REZ2); // ["PP","PF","PM","PG","PB","PZ","PC","PS","PD","PE","FP","FF","FM","FG","FB","FZ","FC","FS","FD","FW","MP","MF","MM","MG","MB","MZ","MC","MS","MD","MH","GC","GS","GD","GE","BC","BS","BD","BW","ZC","ZS","ZD","ZH","CC","CS","CD","CE","SC","SS","SD","SW","DC","DS","DD","DH","EP","EF","EM","EG","EB","EZ","EC","ES","ED","EE","HP","HF","HM","HG","HB","HZ","HC","HS","HD","HW","WP","WF","WM","WG","WB","WZ","WC","WS","WD","WH"]
async function writeJson(filePath:string, o:any) {
try { await Deno.writeTextFile(filePath, JSON.stringify(o)); } catch(e) { console.log(e); }
}
function GET_NEXT_LEVEL(PREV_LEVEL:string[]) {
return JSON.stringify((function (R, P:string[]) {
let O = new Array<string>();
P.forEach(A => { R.get(A.at(-1))?.forEach(B => { O.push(`${A}${B}`)})});
return O ?? [''];
})((
new Map<PER1, PER1[]>([
[ "P", [ "P","F","M", "G","B","Z", "C","S","D", "E" ] ],
[ "F", [ "P","F","M", "G","B","Z", "C","S","D", "W" ] ],
[ "M", [ "P","F","M", "G","B","Z", "C","S","D", "H" ] ],
[ "G", [ "C","S","D", "E" ] ],
[ "B", [ "C","S","D", "W" ] ],
[ "Z", [ "C","S","D", "H" ] ],
[ "C", [ "C","S","D", "E" ] ],
[ "S", [ "C","S","D", "W" ] ],
[ "D", [ "C","S","D", "H" ] ],
[ "E", [ "P","F","M", "G","B","Z", "C","S","D", "E" ] ],
[ "H", [ "P","F","M", "G","B","Z", "C","S","D", "W" ] ],
[ "W", [ "P","F","M", "G","B","Z", "C","S","D", "H" ] ]
])
),PREV_LEVEL));
}
type PER1 = "P" | "F" | "M" | "G" | "B" | "Z" | "C" | "S" | "D" | "E" | "H" | "W";
const REZ1:PER1[] = [ "P", "F", "M", "G", "B", "Z", "C", "S", "D", "E", "H", "W" ];
const REZ2 = GET_NEXT_LEVEL(REZ1);
console.log(REZ2);
type PER2 = "PP"|"PF"|"PM"|"PG"|"PB"|"PZ"|"PC"|"PS"|"PD"|"PE"|"FP"|"FF"|"FM"|"FG"|"FB"|"FZ"|"FC"|"FS"|"FD"|"FW"|"MP"|"MF"|"MM"|"MG"|"MB"|"MZ"|"MC"|"MS"|"MD"|"MH"|"GC"|"GS"|"GD"|"GE"|"BC"|"BS"|"BD"|"BW"|"ZC"|"ZS"|"ZD"|"ZH"|"CC"|"CS"|"CD"|"CE"|"SC"|"SS"|"SD"|"SW"|"DC"|"DS"|"DD"|"DH"|"EP"|"EF"|"EM"|"EG"|"EB"|"EZ"|"EC"|"ES"|"ED"|"EE"|"HP"|"HF"|"HM"|"HG"|"HB"|"HZ"|"HC"|"HS"|"HD"|"HW"|"WP"|"WF"|"WM"|"WG"|"WB"|"WZ"|"WC"|"WS"|"WD"|"WH";
const REZ2:PER2[] =["PP","PF","PM","PG","PB","PZ","PC","PS","PD","PE","FP","FF","FM","FG","FB","FZ","FC","FS","FD","FW","MP","MF","MM","MG","MB","MZ","MC","MS","MD","MH","GC","GS","GD","GE","BC","BS","BD","BW","ZC","ZS","ZD","ZH","CC","CS","CD","CE","SC","SS","SD","SW","DC","DS","DD","DH","EP","EF","EM","EG","EB","EZ","EC","ES","ED","EE","HP","HF","HM","HG","HB","HZ","HC","HS","HD","HW","WP","WF","WM","WG","WB","WZ","WC","WS","WD","WH"];
await writeJson('./REZ3.json', GET_NEXT_LEVEL(REZ2));
const REZ3 = GET_NEXT_LEVEL(REZ2);
console.log(REZ3);
type PER3 = "PPP"|"PPF"|"PPM"|"PPG"|"PPB"|"PPZ"|"PPC"|"PPS"|"PPD"|"PPE"|"PFP"|"PFF"|"PFM"|"PFG"|"PFB"|"PFZ"|"PFC"|"PFS"|"PFD"|"PFW"|"PMP"|"PMF"|"PMM"|"PMG"|"PMB"|"PMZ"|"PMC"|"PMS"|"PMD"|"PMH"|"PGC"|"PGS"|"PGD"|"PGE"|"PBC"|"PBS"|"PBD"|"PBW"|"PZC"|"PZS"|"PZD"|"PZH"|"PCC"|"PCS"|"PCD"|"PCE"|"PSC"|"PSS"|"PSD"|"PSW"|"PDC"|"PDS"|"PDD"|"PDH"|"PEP"|"PEF"|"PEM"|"PEG"|"PEB"|"PEZ"|"PEC"|"PES"|"PED"|"PEE"|"FPP"|"FPF"|"FPM"|"FPG"|"FPB"|"FPZ"|"FPC"|"FPS"|"FPD"|"FPE"|"FFP"|"FFF"|"FFM"|"FFG"|"FFB"|"FFZ"|"FFC"|"FFS"|"FFD"|"FFW"|"FMP"|"FMF"|"FMM"|"FMG"|"FMB"|"FMZ"|"FMC"|"FMS"|"FMD"|"FMH"|"FGC"|"FGS"|"FGD"|"FGE"|"FBC"|"FBS"|"FBD"|"FBW"|"FZC"|"FZS"|"FZD"|"FZH"|"FCC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WP"|"HWF"|"HWM"|"HWG"|"HWB"|"HWZ"|"HWC"|"HWS"|"HWD"|"HWH"|"WPP"|"WPF"|"WPM"|"WPG"|"WPB"|"WPZ"|"WPC"|"WPS"|"WPD"|"WPE"|"WFP"|"WFF"|"WFM"|"WFG"|"WFB"|"WFZ"|"WFC"|"WFS"|"WFD"|"WFW"|"WMP"|"WMF"|"WMM"|"WMG"|"WMB"|"WMZ"|"WMC"|"WMS"|"WMD"|"WMH"|"WGC"|"WGS"|"WGD"|"WGE"|"WBC"|"WBS"|"WBD"|"WBW"|"WZC"|"WZS"|"WZD"|"WZH"|"WCC"|"WCS"|"WCD"|"WCE"|"WSC"|"WSS"|"WSD"|"WSW"|"WDC"|"WDS"|"WDD"|"WDH"|"WHP"|"WHF"|"WHM"|"WHG"|"WHB"|"WHZ"|"WHC"|"WHS"|"WHD"|"WHW";
const REZ3:PER3[]=["PPP","PPF","PPM","PPG","PPB","PPZ","PPC","PPS","PPD","PPE","PFP","PFF","PFM","PFG","PFB","PFZ","PFC","PFS","PFD","PFW","PMP","PMF","PMM","PMG","PMB","PMZ","PMC","PMS","PMD","PMH","PGC","PGS","PGD","PGE","PBC","PBS","PBD","PBW","PZC","PZS","PZD","PZH","PCC","PCS","PCD","PCE","PSC","PSS","PSD","PSW","PDC","PDS","PDD","PDH","PEP","PEF","PEM","PEG","PEB","PEZ","PEC","PES","PED","PEE","FPP","FPF","FPM","FPG","FPB","FPZ","FPC","FPS","FPD","FPE","FFP","FFF","FFM","FFG","FFB","FFZ","FFC","FFS","FFD","FFW","FMP","FMF","FMM","FMG","FMB","FMZ","FMC","FMS","FMD","FMH","FGC","FGS","FGD","FGE","FBC","FBS","FBD","FBW","FZC","FZS","FZD","FZH","FCC","FCS","FCD","FCE","FSC","FSS","FSD","FSW","FDC","FDS","FDD","FDH","FWP","FWF","FWM","FWG","FWB","FWZ","FWC","FWS","FWD","FWH","MPP","MPF","MPM","MPG","MPB","MPZ","MPC","MPS","MPD","MPE","MFP","MFF","MFM","MFG","MFB","MFZ","MFC","MFS","MFD","MFW","MMP","MMF","MMM","MMG","MMB","MMZ","MMC","MMS","MMD","MMH","MGC","MGS","MGD","MGE","MBC","MBS","MBD","MBW","MZC","MZS","MZD","MZH","MCC","MCS","MCD","MCE","MSC","MSS","MSD","MSW","MDC","MDS","MDD","MDH","MHP","MHF","MHM","MHG","MHB","MHZ","MHC","MHS","MHD","MHW","GCC","GCS","GCD","GCE","GSC","GSS","GSD","GSW","GDC","GDS","GDD","GDH","GEP","GEF","GEM","GEG","GEB","GEZ","GEC","GES","GED","GEE","BCC","BCS","BCD","BCE","BSC","BSS","BSD","BSW","BDC","BDS","BDD","BDH","BWP","BWF","BWM","BWG","BWB","BWZ","BWC","BWS","BWD","BWH","ZCC","ZCS","ZCD","ZCE","ZSC","ZSS","ZSD","ZSW","ZDC","ZDS","ZDD","ZDH","ZHP","ZHF","ZHM","ZHG","ZHB","ZHZ","ZHC","ZHS","ZHD","ZHW","CCC","CCS","CCD","CCE","CSC","CSS","CSD","CSW","CDC","CDS","CDD","CDH","CEP","CEF","CEM","CEG","CEB","CEZ","CEC","CES","CED","CEE","SCC","SCS","SCD","SCE","SSC","SSS","SSD","SSW","SDC","SDS","SDD","SDH","SWP","SWF","SWM","SWG","SWB","SWZ","SWC","SWS","SWD","SWH","DCC","DCS","DCD","DCE","DSC","DSS","DSD","DSW","DDC","DDS","DDD","DDH","DHP","DHF","DHM","DHG","DHB","DHZ","DHC","DHS","DHD","DHW","EPP","EPF","EPM","EPG","EPB","EPZ","EPC","EPS","EPD","EPE","EFP","EFF","EFM","EFG","EFB","EFZ","EFC","EFS","EFD","EFW","EMP","EMF","EMM","EMG","EMB","EMZ","EMC","EMS","EMD","EMH","EGC","EGS","EGD","EGE","EBC","EBS","EBD","EBW","EZC","EZS","EZD","EZH","ECC","ECS","ECD","ECE","ESC","ESS","ESD","ESW","EDC","EDS","EDD","EDH","EEP","EEF","EEM","EEG","EEB","EEZ","EEC","EES","EED","EEE","HPP","HPF","HPM","HPG","HPB","HPZ","HPC","HPS","HPD","HPE","HFP","HFF","HFM","HFG","HFB","HFZ","HFC","HFS","HFD","HFW","HMP","HMF","HMM","HMG","HMB","HMZ","HMC","HMS","HMD","HMH","HGC","HGS","HGD","HGE","HBC","HBS","HBD","HBW","HZC","HZS","HZD","HZH","HCC","HCS","HCD","HCE","HSC","HSS","HSD","HSW","HDC","HDS","HDD","HDH","HWP","HWF","HWM","HWG","HWB","HWZ","HWC","HWS","HWD","HWH","WPP","WPF","WPM","WPG","WPB","WPZ","WPC","WPS","WPD","WPE","WFP","WFF","WFM","WFG","WFB","WFZ","WFC","WFS","WFD","WFW","WMP","WMF","WMM","WMG","WMB","WMZ","WMC","WMS","WMD","WMH","WGC","WGS","WGD","WGE","WBC","WBS","WBD","WBW","WZC","WZS","WZD","WZH","WCC","WCS","WCD","WCE","WSC","WSS","WSD","WSW","WDC","WDS","WDD","WDH","WHP","WHF","WHM","WHG","WHB","WHZ","WHC","WHS","WHD","WHW"];