M2: 체스·장기 추가

- 체스(chess.js 1.4.0, BSD-2): 캐슬링·앙파상·승진·체크메이트·스테일메이트·3회 반복·50/75수·기물 부족,
  피셔 시계(상대가 메이트 불가면 시간패 대신 무승부), 무르기·무승부·기권, 직접 그린 SVG 기물,
  클릭·드래그 이동, 승진 선택, 판 돌리기 (테스트 40개, perft 포함)
- 장기: 궁성 대각·포다리·멱·장군 합법성·빅장(KJF/KJA/끔)·반복 수 처리·한수쉼·점수 판정(한 덤 1.5),
  상차림 단계(순서/동시 비공개), 초읽기, 팔각 기물(한자+한글), 한 쪽이면 판 뒤집기 (테스트 46개)
- 게임 공통 E2E에 체스·장기 추가(PC 방장 + 휴대폰 친구, 상차림→첫 수)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-04 05:24:11 +09:00
parent c5c30d4ada
commit 62a6caa6a7
11 changed files with 4822 additions and 0 deletions

View File

@@ -27,6 +27,34 @@ const PLANS: Record<string, Plan> = {
// cursor starts at d4 (3,3): black d3 = up; then white c3 = up, left
moves: [['ArrowUp', 'Enter'], ['ArrowUp', 'ArrowLeft', 'Enter']],
},
chess: {
// cursor starts on the e-file pawn of whoever is at the bottom: white e2-e4, black d7-d5 (board flipped)
moves: [['Enter', 'ArrowUp', 'ArrowUp', 'Enter'], ['Enter', 'ArrowUp', 'ArrowUp', 'Enter']],
},
janggi: {
// Both sides pick 안상차림 (order may be han-first), then each pushes the centre 졸 one step.
setup: async (host, guest) => {
for (let round = 0; round < 20; round++) {
let picked = false;
for (const p of [host, guest]) {
const btn = p.getByRole('button', { name: /^안상차림/ });
if ((await btn.count()) && (await btn.isEnabled())) {
await btn.click();
picked = true;
}
}
if (await host.evaluate(() => !document.body.innerText.includes('상차림을 골라'))) {
if (await guest.evaluate(() => !document.body.innerText.includes('상차림을 골라'))) return;
}
if (!picked) await host.waitForTimeout(200);
}
throw new Error('상차림 단계가 끝나지 않음');
},
moves: [
['ArrowUp', 'ArrowUp', 'Enter', 'ArrowUp', 'Enter'],
['ArrowUp', 'ArrowUp', 'Enter', 'ArrowUp', 'Enter'],
],
},
};
const games = process.argv.slice(2).length ? process.argv.slice(2) : Object.keys(PLANS);