public MoveBuilder Start(BoardIndex index) { builtMoves = new List <BoardIndex> { index }; return(this); }
public List <BoardIndex> GetPossibleMoves(BoardIndex begin) { FirstMoveDoneHandler firstMoveDoneHandler = new FirstMoveDoneHandler(board); CannotBeatHandler cannotBeatHandler = new CannotBeatHandler(board); BeatHandler beatHandler = new BeatHandler(board); MoveHandler moveHandler = new MoveHandler(board); firstMoveDoneHandler.SetNext(cannotBeatHandler).SetNext(beatHandler).SetNext(moveHandler); return(firstMoveDoneHandler.GetMoves(begin, new List <BoardIndex>(builtMoves))); }
public bool Move(BoardIndex to) { var possible = GetPossibleMoves(builtMoves.Last()); if (possible.Count == 0) { return(false); } if (!possible.Contains(to)) { return(false); } builtMoves.Add(to); return(true); }