A queen, a rook and a bishop are randomly placed on distinct squares of an ordinary chessboard.
Find the probability that:.
(i) The queen is under attack from either the bishop or the rook.
(ii) The bishop is neither under attack from the queen, nor under attack from the rook.
(In reply to
re: computer aided solution by Jer)
Yes, the blockings are taken care of by the likes of this statement that comes between seeing an initial alignment and the actual counting of the hit:
If qbRowDiff = 0 Then If Sgn(qbColDiff) = Sgn(qrColDiff) And Abs(qbColDiff) < Abs(qrColDiff) Then hit = 0
Which says in effect that if the queen and the bishop are in the same row and the direction of the queen to the bishop in terms of columns is the same as the direction of the queen to the rook and the queen is closer (in columns) to the bishop than to the rook, then there is no hit on the queen from the rook.
Of course no computer program is guaranteed to be bug free. The code is presented to make sure I put all such checks into place where they're needed, as checked over by other eyes than mine, and that is also the purpose of submitting a large sampling of cases that were found to be hits: so someone not versed in computer programming can look over those samples and see if it includes any cases where the hits should be considered as blocked. (which is also why I show samplings of hits rather than misses, even in the case where I reverse the probability from p to q as required by part ii).
Edited on August 30, 2016, 7:53 am
|
Posted by Charlie
on 2016-08-30 07:45:29 |