컴퓨터 난이도(쉬움 35%·보통 40%·어려움 25%)와 사람 같은 수, 서버 난수를 OS 보안 난수로
- secureRandom(): crypto.getRandomValues 53비트 실수. 서버의 Math.random(컴퓨터 수·생각 시간·AI 말·방 코드·마감 유예)을 모두 교체 - 컴퓨터 id의 ULID를 secureRandom으로 만들고, 그 무작위 부분 30비트로 난이도·말투(smart)를 정함(botDraw) - humanBest: 오목·체스·장기·오델로·바둑에서 난이도별로 비슷한 수(slip)·사고(lapse)·꼭 둬야 할 수 놓침(miss) - 문서 09 §9.1(확률표·게임별 기준·대국 결과), 06 §12; 테스트 bots/level.test.ts, 레벨별 완주 테스트 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* prise > 장군 > activity. Knows 빅장 (judged by score), the 4th-repetition rule and when a 한수쉼 ends the game.
|
||||
*/
|
||||
import type { BotStrategy } from '../bots/types';
|
||||
import { answerRequests, best, pick, playable, typeOf } from '../bots/policy';
|
||||
import { answerRequests, humanBest, pick, playable, typeOf } from '../bots/policy';
|
||||
import type { JanggiView } from './index';
|
||||
import {
|
||||
HAN_BONUS,
|
||||
@@ -77,7 +77,7 @@ function threat(b: Board, me: Side): number {
|
||||
return worst;
|
||||
}
|
||||
|
||||
export const janggiBot: BotStrategy<JanggiView> = ({ view, legal, random }) => {
|
||||
export const janggiBot: BotStrategy<JanggiView> = ({ view, legal, random, level }) => {
|
||||
const req = answerRequests(legal);
|
||||
if (req) return req;
|
||||
const moves = legal.filter((a) => typeOf(a) === 'move') as Move[];
|
||||
@@ -134,5 +134,6 @@ export const janggiBot: BotStrategy<JanggiView> = ({ view, legal, random }) => {
|
||||
return base;
|
||||
};
|
||||
const options: (Move | Pass)[] = pass ? [...moves, pass] : moves;
|
||||
return best(options, (a) => (typeOf(a) === 'pass' ? passScore() : scoreMove(a as Move)), random);
|
||||
// 100 = one point of material; 외통 (1e7) and a winning judgement (1e5) are must-play moves.
|
||||
return humanBest(options, (a) => (typeOf(a) === 'pass' ? passScore() : scoreMove(a as Move)), random, level, { small: 40, critical: 1e5 });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user