import Board from '../common/Board' ; import { STATUS } from "../common/define" ; export default abstract class Evaluator { public abstract evaluate ( board ) ; protected threshold : number = 0 ; protected maxSearchDepth : number = 0 ; get WIN ( ) : number { return this . threshold + this . maxSearchDepth ; } get LOST ( ) : number { return - ( this . threshold + this . maxSearchDepth ) ; } win ( step ) { return this . threshold + this . maxSearchDepth - step ; } lost ( step ) { return - ( this . threshold + this . maxSearchDepth - step ) ; } isWin ( score , step ) { return score >= this . threshold + this . maxSearchDepth - step ; } isLost ( score , step ) { return score <= - ( this . threshold + this . maxSearchDepth - step ) ; } }