Exemplo n.º 1
0
        protected override void AfterMove()
        {
            if (capturingPiece.X != -1)
            {
                Draught capturePiece = pieces[capturingPiece.X, capturingPiece.Y] as Draught;

                if (capturePiece.white)
                {
                    if (capturingPiece.Y == 0)
                    {
                        goto changeTurn;
                    }
                }
                else
                {
                    if (capturingPiece.Y == 7)
                    {
                        goto changeTurn;
                    }
                }

                capturePiece.PossibleCaptures(this, capturingPiece.X, capturingPiece.Y, out bool any);
                if (!any)
                {
                    goto changeTurn;
                }
            }
            else
            {
                goto changeTurn;
            }

            return;

changeTurn:

            SwapTurn();
            capturingPiece = new Point(-1);

            base.AfterMove();

            if (!ColourCountThreshold(turn, x => x > 0))
            {
                if (turn == playerWhite)
                {
                    GameEnd("You lost!");
                }
                else
                {
                    GameEnd("You win!");
                }
            }
            else if (!CanMove(turn))
            {
                GameEnd("It's a draw!");
            }
        }
Exemplo n.º 2
0
 public void startGame(int size, Draught.Intelligence p1, Draught.Intelligence p2)
 {
     loop.startGame(size, p1, p2);
     this.showInGameLable();
 }