(tag)
| 150 | } |
| 151 | |
| 152 | async run(tag) { |
| 153 | const tryRecognize = async () => { |
| 154 | const x = await this.recognize(); |
| 155 | |
| 156 | if (x > 0) { |
| 157 | return x; |
| 158 | } |
| 159 | // retry |
| 160 | return await tryRecognize(); |
| 161 | }; |
| 162 | const puzzleX = await tryRecognize(); |
| 163 | const pos = new MousePosFaker(puzzleX).run(); |
| 164 | const d = getCoordinate(pos); |
| 165 | await sleep(pos[pos.length - 1][2] - Date.now()); |
| 166 | const result = await JDJRValidator.jsonp('/slide/s.html', {d, ...this.data}); |
| 167 | |
| 168 | if (result.message === 'success') { |
| 169 | console.log(result); |
| 170 | console.log('JDJRValidator: %fs', (Date.now() - this.t) / 1000); |
| 171 | return result; |
| 172 | } else { |
| 173 | process.stdout.write(`Thread-${tag}`) |
| 174 | console.count(JSON.stringify(result)); |
| 175 | await sleep(300); |
| 176 | return await this.run(tag); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | async recognize() { |
| 181 | const data = await JDJRValidator.jsonp('/slide/g.html', {e: ''}); |
no test coverage detected