All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Games
Queen Placements (Posted on 2013-07-05) Difficulty: 3 of 5
Consider a 5 x 5 version of a chessboard with one player having five queens and the other player having three queens. There are no other pieces. Place the queens on the board so that neither player's queens can capture one of his or her opponent's queens.

*** For the purpose of simplicity, assume the white side has the greater number of queens.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2

DIM used(24)
OPEN "queenplc.txt" FOR OUTPUT AS #2
FOR a = 0 TO 24
 used(a) = 1
 arow = a \ 5: acol = a MOD 5
 bd(arow, acol) = 1
FOR b = a + 1 TO 24
 IF used(b) = 0 THEN
   used(b) = 1
   brow = b \ 5: bcol = b MOD 5
   bd(brow, bcol) = 1
FOR c = b + 1 TO 24
 IF used(c) = 0 THEN
   used(c) = 1
   crow = c \ 5: ccol = c MOD 5
   bd(crow, ccol) = 1
FOR d = c + 1 TO 24
 IF used(d) = 0 THEN
   used(d) = 1
   drow = d \ 5: dcol = d MOD 5
   bd(drow, dcol) = 1
FOR e = d + 1 TO 24
 IF used(e) = 0 THEN
   used(e) = 1
   erow = e \ 5: ecol = e MOD 5
   bd(erow, ecol) = 1

   safect = 0
   FOR r = 0 TO 4
     FOR cl = 0 TO 4
       safe = 1
       IF arow = r OR brow = r OR crow = r OR drow = r OR erow = r THEN safe = 0
       IF acol = cl OR bcol = cl OR ccol = cl OR dcol = cl OR ecol = cl THEN safe = 0
       IF ABS(arow - r) = ABS(acol - cl) THEN safe = 0
       IF ABS(brow - r) = ABS(bcol - cl) THEN safe = 0
       IF ABS(crow - r) = ABS(ccol - cl) THEN safe = 0
       IF ABS(drow - r) = ABS(dcol - cl) THEN safe = 0
       IF ABS(erow - r) = ABS(ecol - cl) THEN safe = 0
       IF safe THEN safect = safect + 1: safer(safect) = r: safec(safect) = cl
     NEXT
   NEXT
   IF safect > 2 THEN
      FOR r = 0 TO 4
       FOR cl = 0 TO 4
        flag = 0
          FOR r2 = 1 TO safect
           IF r = safer(r2) AND cl = safec(r2) THEN PRINT #2, " x"; : flag = 1
          NEXT
          IF flag = 0 THEN IF bd(r, cl) THEN PRINT #2, " *"; :  ELSE PRINT #2, " .";
       NEXT: PRINT #2,
      NEXT: PRINT #2,
      solct = solct + 1
   END IF

   bd(erow, ecol) = 0
   used(e) = 0
 END IF
NEXT e
   bd(drow, dcol) = 0
   used(d) = 0
 END IF
NEXT d
   bd(crow, ccol) = 0
   used(c) = 0
 END IF
NEXT c
   bd(brow, bcol) = 0
   used(b) = 0
 END IF
NEXT b
 bd(arow, acol) = 0
 used(a) = 0
NEXT a

PRINT solct

CLOSE

finds all 8 versions (rotations and reflections) of the solution, using * and x to represent the two colors:

 . * * . .
 . * . . *
 . . . . *
 x . . . .
 x . . x .
 . * * . .
 . . . . x
 * . . . .
 * * . . .
 . . . x x
 . . * * .
 * . . * .
 * . . . .
 . . . . x
 . x . . x
 . . * * .
 x . . . .
 . . . . *
 . . . * *
 x x . . .
 . . . x x
 * * . . .
 * . . . .
 . . . . x
 . * * . .
 x x . . .
 . . . * *
 . . . . *
 x . . . .
 . . * * .
 . x . . x
 . . . . x
 * . . . .
 * . . * .
 . . * * .
 x . . x .
 x . . . .
 . . . . *
 . * . . *
 . * * . .

The program can easily be modified to answer this question:

If six white queens are appropriately placed on a 6x6 board, how many black queens can be accommodated in the same manner as in the current puzzle?


  Posted by Charlie on 2013-07-05 19:25:35
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information