コード例 #1
0
 public MoveBuilder Start(BoardIndex index)
 {
     builtMoves = new List <BoardIndex>
     {
         index
     };
     return(this);
 }
コード例 #2
0
            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)));
            }
コード例 #3
0
            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);
            }