Files
moyu-qile/tests/hint.test.js
T
personal82555 b143766643 feat: 摸鱼棋乐 — 象棋/五子棋/军棋三合一网页棋类游戏
- 象棋:完整规则引擎 + α-β 搜索 AI(三档难度)
- 五子棋:攻防评分 AI(困难档会堵活四连四)
- 军棋:标准 5x12 陆战棋翻棋(行营/大本营/铁路/山界),暗棋定色
- 通用:双人同屏、残局挑战、悔棋、存档(手动+每分钟自动覆盖)、刷新续局、战绩排行、倒计时、离开提醒、AI 教练
- 部署:纯 Node.js + Docker,数据卷持久化,存档/战绩按游戏独立文件
2026-10-08 15:27:10 +08:00

19 lines
911 B
JavaScript

const http = require('http');
const srv = http.createServer((req, res) => {
let b = ''; req.on('data', d => b += d);
req.on('end', () => {
res.writeHead(200, {'Content-Type':'application/json'});
res.end(JSON.stringify({ choices: [{ message: { content: '建议炮二平五,中路压制。' } }] }));
});
});
srv.listen(7321, '0.0.0.0', async () => {
const payload = JSON.stringify({ baseUrl: 'http://172.17.0.1:7321/v1', apiKey: 'test', model: 'mock', prompt: '象棋开局' });
const rq = http.request({ host: '127.0.0.1', port: 7025, path: '/api/ai-hint', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } }, rs => {
let o = ''; rs.on('data', d => o += d);
rs.on('end', () => { console.log('hint:', o); srv.close(); process.exit(0); });
});
rq.write(payload); rq.end();
});
setTimeout(() => process.exit(1), 12000);