Example #1
0
        private void Perform_Move(string smove, int player)                      //performs the move (doesnt check for valid)
        {
            List <Piece> move = Split(smove);

            //reversible moves resets to 0 if moved with a uncrowned piece
            reversible_moves++;
            if (board[move[0]] == 'b' || board[move[0]] == 'w')
            {
                reversible_moves = 0;
            }
            for (int i = 0; i < (move.Count - 1); i++)
            {
                if (i > 0)
                {
                    drawing.Invalidate(); drawing.wait(300);
                }
                //if its a jump remove the middle piece and set reversible moves to 0
                if (is_jump(move[i], move[i + 1]))
                {
                    reversible_moves = 0; board[between(move[i], move[i + 1])] = '.';
                }
                board[move[i + 1]] = board[move[i]];
                board[move[i]]     = '.';
            }
            //men that reach the kingsrow are crowned
            Piece final = move[move.Count - 1];

            if (final.Item2 == 7 && player == 0)
            {
                board[final] = 'B';
            }
            if (final.Item2 == 0 && player == 1)
            {
                board[final] = 'W';
            }
        }