insertPiece() 공개 메소드

public insertPiece ( int x, int y, Piece iPiece ) : void
x int
y int
iPiece Piece
리턴 void
예제 #1
0
        // egy lépés szimulálása
        public override IState SimulateStep(IState current, AbstractStep step)
        {
            if (!(step is QuartoStep))
                throw new Exception("Not proper step type!");
            QuartoStep cStep = (QuartoStep)step;
            Board returnBoard = new Board((Board)current);

            if (returnBoard.SelectedPiece == null)
            {
                returnBoard.SelectedPiece= cStep.P;
                returnBoard.UpdateActivePieces(returnBoard.ActivePieces, returnBoard.SelectedPiece);

            }
            else
            {

                   returnBoard.insertPiece(cStep.X, cStep.Y, returnBoard.SelectedPiece);
                   returnBoard.SelectedPiece = null;
                   returnBoard.checkWinningState();

            }

            if (returnBoard == (Board)current)
            {
                return null;
            }
            return returnBoard;
        }