(file)
| 45 | } |
| 46 | |
| 47 | function readProblems(file) { |
| 48 | const source = fs.readFileSync(file, "utf8"); |
| 49 | const match = source.match(/window\.WS_PROBLEMS\s*=\s*([\s\S]*?);\s*$/); |
| 50 | if (!match) throw new Error(`Cannot find window.WS_PROBLEMS in ${file}`); |
| 51 | return JSON.parse(match[1]); |
| 52 | } |
| 53 | |
| 54 | function difficulty(value) { |
| 55 | if (value === "简单") return "easy"; |