import { config } from "../constants/config"

const Easy = [
  "aBCeIGFhdEDFcAHBGIhigBdfecAgHDiFBCaeBEAGHCIdffcIdEAHbgcABfGEdiHIFHaCDGEBDGEHbiaFC",
  "abecfIgdhdICGhbAFEHGfeAdIcBCFAbigEHDGDhFeABICIEbHdCFGAFaGDBHcEIbCDIGehAFeHIaCFdbG",
  "AbIGdeHFCHFDbCieaGgEcfaHbDIEiAdBFGcHFHGcEAIBddCBHIGFEaCdfiGBAHEbgeAHCDIfIaHefdCgB",
  "ACEdBIGHFBHGFacDEIdiFheGAbCcEiBdFHaGhfBGIAecDGadcHeIfBIgCaFHbDEFdAegbcIHEBHICDfGa",
  "acEIhbgFDFIDAgEBHCBGHfCdeaIDEaBFgicHcFGHAidebIHbDecaGFeBFCIAHdGGDCebHfIAHAiGdfCBE",
  "aCfDbGHIEGHBIcEFdaedIAFhbCGDFahGiebCHbecaDIGFiGCbEFdAHBEHGIcAfDFiGedACHBCAdFHBgei",
  "ACGBfIHDeHEBCdgFAIfdIHaegcBDgEAHCIBFIbhFEdaGCcAFGIbDEHgIDebHcfabHADcFEiGEfcigABHd",
  "AcGFdihBEdHEbGCAifBFIEhaGDCEgADIBfcHhibGcfDEaFDChaEigbGBHCFdEAIIEdabHCFGcAfIEGbHD",
  "ACGIFbEhdbFEDGhaCIIHDCAEBGFFAIHBDceggdbecfIahHEcAIGdFBeIHFDAGBcdGFbeCHIacbAgHifdE"
]
const Medium = [
  "achEDIBFGgeIHbFaDCFDBaCGHeIbHaceDGiFCIFGHBeadeGDIFAChbDAGbIeFCHhfEdGCIbaiBcFAhdGE",
  "ADBeIGhFCGhCDFabiefiECHBgDACGDbaFieHEBIHGCFADhFAIedCbGdAFGbheCIbEhaciDGFIcGFDeaHb",
  "aDBIEcHFGEGHbDFcaiIFCAGHeDbgHdEIafBCCIaHFbdGeBefGcdIHADCGFbeAIHhbedAIGcFFaIcHgBEd",
  "AdEGCHfibHGbefIacdCIFABdehgICgHDAbFefahbecDgIEBDIGFCAHbeICAGHDFGFCDheIbADHAFIBGec",
  "ADeIBFgHCIHFcgabdebGCeDhaIfHfaDeIcGbgIBFacHEdECdBHGFaiFBHAIEDcGDeGHcBiFaCAIgFDEBH",
  "aDFIEHbcGciHaGbFDEeGBcdFHIAbeadhCgfIGHIfBEcAdFCdGAIeHBDAeHcgibFHFGbIDaECIBcEFADGh",
  "aDgEICFBHHCFdGBAeIIEBFHacdgcAEgBIdhFDGhCFEiabBFIADHEGCGbciaDHfEEHdbcFgiAFiAHeGbcd",
  "adHEbCIfGegBfHIDAcIcfgDaHEBDFABIGcHEHIcdfegbaBEGcAHFdIFAdIgBeCHCbihEFAGdghEACDBIF",
  "aecDbHIGFDGHCFIBEAfiBEGaHCdgAFBIedHcHCEaDFGBIbDIghCFAeibahcdeFGcHdfeGAIBefGIAbCDH"
]
const Hard = [
  "AEdfiHgCBIFGECbahdcbHGADeIFGIFCDaBeHHDCbGEIFAeabhfICdgbCIAHFDGeFGadEcHBiDHeIBgFac",
  "aEFGBihCdHcIefdGBAGdbcahIfeIBAFDcegHDHEAGBCiFFgcHIEadBeFHDCGBaicidBHAFEGbAGIeFDHC",
  "AEGIdchFBFICbehgAdbHDFAGeIchdEgBaFCiGbfchIadeCAIefdbGHdfBaIeChGEGHdCFibAIcaHGbDEf",
  "afbCGDehiIGhEaFCdBECDIbHAFGhEGADbfICdbifechGAFACHIGbeDgDFBHAIcEcIaDFeGBHBHegCIdaF",
  "AFhIgCdEBcEGDBHAFIiDbfaeGCHhGIEcfbdafcdBIAHGEBaeHdGCIfEBACFdIHggHcAeiFbDdiFGHBEAC",
  "agcfdHbEIHBDEIGCaFFiecBAhGDBEghcFIdaDHiAGbEfCCAFiEdGBHGCabfIdHeIDHgAEFCbEFBdHcAIg",
  "agibdeFchcHDGIfeBAEFbHAcDIgiDCAEBGHFHBeDFGCaIFAGICHBdEgEaCBihfdbIfeHDAGCdCHFGaIeb",
  "AHbIEDcGFCifgHBAdeGEDAfcIHBBdGHCEFaiIFcbdaHeGHaeFIGBCDeBAcGFdIhFGHDaieBcDcIebhGFA",
  "AHEbCIGfdiBGDEFHCAdfcHGaBIEBGICfdaeHhCFEAbIdGEAdihgFbcFIAgDECHbcdBAIHegfGEHFbcdAI",
  "AHECBgFdIBIGDAfhCECfDHIEagbIGHEDcBFAEBFAGichddCaBFHeigFEIgHadbChDcIeBGaFGabFcdiEH"
]
const Expert = [
  "AHEIDCFGBiBFGaedchcdghbfIEADfHEIACBgbeADCGHfiGCibFHaDEeaBcHDGIFHIdFgBeAcFGCaeIBhD",
  "AHEIFGcbDDgBacefhIFIcBdHGeACbdHIFAgehfgEAcIDbEaIGBDHFCIEAFGbdcHBDFchaeiGgCHDEIbAF",
  "aIBCFDeHGcGFHaeIdbdHEIGBafCFDGahcbieBeaGDIHcFICHEBfdGAHADFEgcbIgBIdcaFEHEFCbiHGAd",
  "AIBHEFDcGEFcaDGihbHDGBCIAefGHFiadEBCBCAeFHGIdIEDGBcHFaCAiFGebdhfbHdIaCgedgECHbfAi",
  "aiDHBEfCGCGEFIdhBABFHCaGEdiIDGEHbcAfHABifcdgeECFgDaIHBFBaDEHGiCdECbGIafHGhiacFBed",
  "aIgdfbhcEdBEHCiGFAFCHEGaBdIIFbCAGDEHcHABDeFigegdIHFCabBDiFEHAGcHACGIDEBFGefabcihd",
  "AIGdFebCHBfHiaCdGEEDcgHbIaFgcBfeAHIdiHecgDfBAfaDbIhgeccbfaDIeHGhGIECFadbdeAHBGCFI",
  "baDEHGIFCGIHDCfABEceFAIBgdhfdchGIEABIgAbdEHcFEHbfaCDGIABeGFhciddFiCEabhGHCgIBdFEA",
  "baicHdegFHEdIFGcABGFCaebhidfbadGCIHEICEfAhBDGdGHBIeaFCAHBEDfGCICDGHBifEaeiFGCADBh",
  "BaiGFcdEHdFCHEAIGBhEgbDIcfaCidFAeBHGFBACGhEIdghEDibAcfEdBIHFgAcaGHECdFBIICfabGHDe",
  "bCFIGHADeHAGdFebCIDIEaBcFGHEbHGAFDIcgdCbhieFaafiCEDHBGCEBHdGIafIHAFcbgeDfgDeiACHb",
  "BdaHFIEGCicHDgEafBEGFBACDIHfbDcEgIHAHAIFBdgceCeGihAbDFDIbEchFaggFCadbHEIaHEGIfcBD",
  "BDCEFiGAHIHacGBeDFGEFHADIBcEIdfHACgBhCGbDEaFIFABgicdHeaFhiEgbCdDbiaChfeGCGEdbFHIa",
  "bdEcFAHIGCAIegHFBDFGHBDICaEehfaBDIGCDCgiHeaFBIBAFcgedhaicgEbDHFGeDhAFbcIHFbDiCGEa",
  "BEaihfcdgCFIGEDAHBgDHACBIFeFIdhaeGbcAHGcBIDEfebcdFGHAIDgeBIHFCaHCbFGAeiDIAfEdcbGH",
  "BehdIcaFgCfGeAHIbdaIdfBGCheEgcIDFHAbdAFHeBGCiIHBGcaDefFCIBHdeGAHbeaGIFDCGDACfEBIH",
  "BfHCEGADIIdchAFGbeGaEiBdCHFFBigCADEHHEGBdIfaCDCafhEiGBeGFDIHbCacHdaFBEiGaIbegcHFd"
]
const Extreme = [
  "BGDiEAfchahcFBDIGEEIFhgCDabFAHGibedcDEGACHbIFCbIEdfGHagDACfEHBihFBDAIcegICEbHGaFd",
  "BGFAIHDCEDHicegBAfEACFDbIGHidhbCEgFAaEGIhfcDBFCbgadeHIHIedGafBCcbdhFiAEGGFAEbcHID",
  "BGFHIAdECaiCdBEFGHhDeFcgbaiGFBeAICHdICAGdHEFbdeHCFBGIAFhIBGDACEeBGaHcIDfcadiefhbg",
  "BhAcGEIDFIGdBaFCHefeCHiDGbaeaBFcIdGHcDGEHAFIBhifgdBEACAcIDFHbEGGbHIEcaFDdFeabGhcI",
  "BHeadfiCGICAgbHDEFdFgIEcHabgEHdFabICcadBHIfGEFBICGEAdHeiBFAGcHdHdCeIBGfAaGfHcDEBI",
  "BHFcEdgaigIDAfbEHcCEaIGHBfDdfIGHCAeBhCBeIADGFAGedbFcihFdHBaGIceIacfDEHBGEbGHCIFdA",
  "biADChGFEEHFIagbDCcGDBFEAHIIaeFHDCGBFBHgIcdEadcGebAhIFHfBAGIECDgDICEbFahaechdFibg",
  "bICEGDHFAHFeaICdbGaDGbFHEcIEadfcgIHbFGHIbECAdICBhdAfGEcHiDAbgefGBFceiadhDEAGHFBIC",
  "bieDFaGHcgcaeHiDbFHfDGcBiAECHIBgEFdaDGBHafEciAEFIDcbghFBcaIdheGIdHCEGAFBEAGFBHCID",
  "BIFCAdhGeDhAEbgFCICEgFHiBDaFBEGDAIHCADHicBEfggciHFeDabHGDBicaefiacdeFGbHEFBaGHCID",
  "bihCGEADfFAGIbDchEedCfahbigCFDEIGHbaIbEHdaFGCHGaBCfIEdGcFdHbeAIAEBGFIDcHdhIAEcGFB",
  "CaBhedgfiidHcFGAEbEFGbiahCDAEIGDbFHcFGdIhcebahBCFaEDiGDHAECIBGFbCEdGFIAHGIfaBhCDE",
  "cbFDEGiAHGIacFHdebdeHibAgFcfdIBCehGABHgAIFECdACEgHdfBIIGbFDCahEeAdHGBCIFHfceAIBDG",
  "cbgHEaFdIaIdcbfGEHEHFigDBACbFEAIHdCGhcAEDGIBFDGIBFCehaGDCFABHIEiabGHecfdFehdcIaGB",
  "CbhdAEIGfaEFgibCdhIGDHCFBEafDEBHaGICGibcfdhAehcAIeGFbddFIEbHAcGEHCagIDFBBAGfDCEHI",
  "CDabGEHIFeFhIaCGDbbgIHdFcAEAcEGhbifdGIbCFdaEHdHfaEiBGciaDFCHEbghEgDbafCIFbceiGDha",
  "cdgeAIBfhhbFDCgIAeAiEHbFcDGBFICGEdHAdGhBFaECIeACIdHGbfIedFHcagBGhbaEdficfCagiBHed",
  "cDgIbFEAHehbdGaFICiafecHgDBACIGEBhfdgbdfhiCeAHFECAdbGIBIHAFedcgfGABdCIheDechIGabF",
  "CEBIAFHGDIhAdEgbcfgFdCbheaIFGHACIDEbeBCGFdIhADaIbHEcFgBIEFGcAdHHdGEiaFbcAcFHDBgie",
  "cEHGfdIABFIgCAbhedAbDeIHcGfeABFcGdHIHDFBEIACGigChdafbEbFaDHEgIcGCIAbfeDHDHeIGcBFA",
  "ceIBaDGfhHaGcfiDEbBdFhGEIaCAHbFICEgDGiCdEahbFEfDGhbACIfbhEDGcIAiCeabHFdgdgaIcFBhe",
  "CeiBaGHDfADGfeHIBCbFHidcegAdHCeFagIBIGECHBAFDFBAgIdcHEEaFHBIDcGgidacfBEHHCBdGefaI",
  "cEIDAGFHbgDBEFhICAFHAIBCeGdbGFhIeadCACDBGFHIehIecDAGBFdacGEiBfHIfHAcbDEgEbgfhdCai",
  "CFeabGHIDGBdHEIfcaihACDFBegEGIBadcHFbDcGFHEAIHAFEICgDBAcGihbDFEFIHdgeabcdebfCAIGH",
  "CFEIAdbgHaHicbgDeFGDBEFhcIAeGHADCIfBIcFghbAdEBADFIEhcGFbcHGIeaDHEADCFGbidigBEaFHc",
  "CGaBfHIdEHEiacDFBGDbFIgEHcaadcFBgEIHfhECDIGaBBiGHEadFcgCdEIBAHFiAbgHfCEdEFHdacBGI",
  "CGhAIbfEDFAIEdhcBgDEBCGfHaIIDgbheACFHFcDaIbgeebAGFcIDHGCFibdEHABHDFEaGicaIeHcgDFB",
  "cHbEFDGAIAdIcgBEFHegfhIAcbDHACbDGfieIbEACFDHgGFdIheACBBCaGEHidfdEhfaIBGcFIGDbCHEa",
  "cidGHEBFAFaeBDcIGHbHgAFIECdgeIHafdbcAdfecbHIGHbCDIGAEFEFaCBHgDIDCbIGaFheighFEDCAB",
  "cIFDHAEbgebHgicAfdaGDEFbhCIBDacGFIEHFHIABEGDCgcehdIFABdeGBAHCIFhfciEdbgAIABFCGDhe",
  "CIFeBahdGHGDIcFebabaegDHIcfdhAbEcFGiIfcaHgdEbEBGDFIcAHFcbhaEgidaEIfGDBhCGdHciBAFE",
  "DAeFBIHGcFiCHGeBadhGBadCFeIabgIHDECFIEDGCFabhChFBEAdIGbcadfGIHEEdhCiBgFAGfiEAHCdb",
  "dafibcGHEHIEFdgcbaBCGAHEDIfeHcDgbfaIGBAHIFECDIFdEcAHGbaGBceDIfHFehGaIBdCCdIBfHAEG",
  "DaFIcbHgebeHGDFAiccgiEAHDFBEBcAHgFDIGHdCfibEaIFabEdGcHHIGfBeCAdFCbDIAehGAdEHGcIBF",
  "DaibFEGHCGHECIDaBFcFbGHaIDeHiAedbFcGEgFicHBAdBCDAgFheIIEHdAGcfBFDchBIEGAabgFecDiH",
  "DaIbGFHeCFChaiebdGGeBdCHIFaCbGFADEHIHFAIEbGCdIDEcHgAbFBGcHDafiEEIFGbcdahahdEFiCGB",
  "dAIcebGFHgBEHFaCiDhcFdgIAbeIDBFaGeHcCeAIDHFgBfGhBcEIdABFgAHCDEIAHdeIFBcGeICGbDhaf",
  "dbFECIAgHIGaFDHBCeHEcAGbDiFFDBgheiacECGIAFHBDaIHDbceFGcHEbfaGDibfdHIGCEAgaiCEDFhb",
  "DbgiCFaehcaehbdIGFHIfAEGCBDgfCeIHDABIHAbDCGFEEdbFGAhCIBEDcaiFHGaGHDfBEIcFciGhEbdA",
  "DEbfcgaHIFaIHDbCegcHGaiEFbDAfebhdIGcidCEGABFHgBHcFIdAEhgfibceDaeIdGafHcBBCaDEhGIF",
  "dEGHAfIbCBIHcEGFDACFABDIEGhFhbagCdIEEDCfibhAGGAIeHdBCFIGfdcHaEbHCeibaGFDAbdgFechI",
  "DFACBhGIEgchaIeFDbBEIFDGaChAHFbgidEcedcHAfbGIIGbdecHAFFBGECDIHAcadIHbefGHiEgFACBD",
  "dfbeahiCgECgiDbfHAAihGFCdeBGbFHCDEAihDIAgecBFcaEBIFgDHFGDCHaBIEIeADBGHFcBHcFEIaGd",
  "dfeGchaIBICAFbeHgdgBHdAIfceCHIAeBGdfAGBIFDEHcFEDHGCIBaEDgcIFBAHHIfbdAceGbACehGDFi",
  "dGaICHBFEFBIAedHcGCEhgBFIADHcEdfagBiaIbeHGCDfgDFciBEHAEAdHGCFIbbhgFdIaEcIFcbAEDGh",
  "dGeihbaCFHFBCADgIECiaeFGBDHEDIgBHcfAbACFDiHEGGHFaEcibdaehBIFDGcFBGdcaEhIICDHgEfaB",
  "dHcIFGABEIegCABFdHFbADHEIgCaGFebdCHIEDHaCIBFgciBHGFEadbaDGechiFhCIFDageBGfEBiHDca",
  "dHGaicbeFEacFHBIDgIbFeDghcAHeIDcAFGBFdbHgECaIGcABFIDHeaIHcEFgbDBfDGAHEiCCGEIbdAFh",
  "DICbAEhgfFaGIHDBCEbEHFCGADIEcBGDIFAhaDFCeHibggHiAFBdECIbehGAcFdcGadIFEhBhFDebcGia",
  "diGbCEaHFAfCIdhEBghBeAGFCdiCEbDHGFIAIgdfEaBcHFaHcIBgedgcAhBdIFEEDiGfchabbHFEaidgc",
  "diGEHFBCAHcaIBGEdfeFbCadIhgiGEDFAHBCaHFBcEDGICBDHGIfAegdcFEBAIHbehAIcGfDFaIGdhceb",
  "eaBdfIHGcIGdCHbFAEfHCAGEDBigcebdHAIFhFAiECGdBBdifAGECHabFecdIHGDiHGBFCeaCEgHIabFD",
  "EABFHiGcDHdICgaebfcGFBdeAHIaCDHIgBFEbFeaCDIGHiHGEFBdACfbaDECHIGgEHiBfcdadICGahFeB",
  "eacIBFhdgGHBecDaFIDIfgAhCBECFGHDEiabIdHaGBECFabeCFIGHDfCiBHGdeAHgdFEabIcBEADiCFGh",
  "EadCFbIhGbGCiahdeffhiGedcABGDbEiFHCACEadhgbFIIfHBcAeGddCfabegiHaBEHGIFDChIGFDcaBE"
]

export class LevelManager {
  private static instance: LevelManager
  public static getInstance(): LevelManager {
    if (!LevelManager.instance) {
      LevelManager.instance = new LevelManager()
    }
    return LevelManager.instance
  }

  private levelMap: Map<string, Array<string>> = new Map()

  public init(): void {
    this.levelMap.set(config.DIFFICULTY_TYPE.Easy, Easy)
    this.levelMap.set(config.DIFFICULTY_TYPE.Medium, Medium)
    this.levelMap.set(config.DIFFICULTY_TYPE.Hard, Hard)
    this.levelMap.set(config.DIFFICULTY_TYPE.Expert, Expert)
    this.levelMap.set(config.DIFFICULTY_TYPE.Extreme, Extreme)
    // 检查关卡配置
    this.levelMap.forEach((list, key) => {
      for (let i = 0; i < list.length; i++) {
        if (list[i].length !== 81) {
          console.error("关卡配置有误>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", key, i)
        }
      }
    })
  }

  public getLevelList(difficulty: string): Array<string> {
    const list = this.levelMap.get(difficulty)
    return list
  }

  public getLevelStr(difficulty: string, index: number): string {
    const list = this.levelMap.get(difficulty)
    if (list) {
      return list[index]
    }
    return ""
  }
}
