Our King must never be Attacked!

In a basic game of chess, if there's only two pieces left: a king and a rook. How many ways can a king be safe from the opponent's rook if they are placed in all possible combination?

Details and Assumptions :

  • Assume there is no opponent's king.

  • This is a Computer Science problem.


The answer is 3136.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

There are 14 14 places in range of the rook, if the rook is placed in any place, excluding its own place. So the rest is 63 14 = 49 63-14=49 . Since there are 64 64 probabilities where the rook was placed, so

64 49 = 3136 64*49=3136

Brock Brown
Mar 3, 2015

Python:

1
2
3
4
5
6
7
8
from itertools import product
def safe(a, b, c, d):
    return a != c and b != d
count = 0
for a, b, c, d in product(xrange(8),repeat=4):
    if safe(a, b, c, d):
        count += 1
print "Answer:", count

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...