import { PIECE } from './define' ; import Point from './Point' ; export default class Move { from : Point ; to : Point ; target : PIECE | null ; protege : PIECE | null ; constructor ( from , to ) { this . from = from . clone ( ) ; this . to = to . clone ( ) ; this . target = null ; this . protege = null ; } attack ( piece ) { this . target = piece ; } guard ( piece ) { this . protege = piece ; } toString ( ) { return this . from . toString ( ) + "-->" + this . to . toString ( ) ; } clone ( ) { let move = new Move ( this . from , this . to ) ; move . attack ( this . target ) ; move . guard ( this . protege ) ; return move ; } }