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

Home > Logic
Card Tableau in Black and White (Posted on 2010-11-30) Difficulty: 3 of 5
There are 16 cards: 8 black and 8 white. On each card is a number between 1 and 4 inclusive. There are:

4 white cards with a 1     6 black cards with a 1
2 white cards with a 2     2 black cards with a 2
1 white card with a 3 
1 white card with a 4 

Arrange the cards into a 4x4 grid such that the number on each card represents the number of black cards among its 2, 3 or 4 orthogonally adjacent cards, and so that the top-rightmost card is a black card with a 1 on it.

  Submitted by Charlie    
No Rating
Solution: (Hide)
CLS
FOR a = 0 TO 8
 ra = a \ 4 + 1: ca = a MOD 4 + 1
 grid(ra, ca) = 1
FOR b = a + 1 TO 9
 rb = b \ 4 + 1: cb = b MOD 4 + 1
 grid(rb, cb) = 1
FOR c = b + 1 TO 10
 rc = c \ 4 + 1: cc = c MOD 4 + 1
 grid(rc, cc) = 1
FOR d = c + 1 TO 11
IF a = 3 OR b = 3 OR c = 3 OR d = 3 THEN
 rd = d \ 4 + 1: cd = d MOD 4 + 1
 grid(rd, cd) = 1
FOR e = d + 1 TO 12
 re = e \ 4 + 1: ce = e MOD 4 + 1
 grid(re, ce) = 1
FOR f = e + 1 TO 13
 rf = f \ 4 + 1: cf = f MOD 4 + 1
 grid(rf, cf) = 1
FOR g = f + 1 TO 14
 rg = g \ 4 + 1: cg = g MOD 4 + 1
 grid(rg, cg) = 1
FOR h = g + 1 TO 15
 rh = h \ 4 + 1: ch = h MOD 4 + 1
 grid(rh, ch) = 1

REDIM ct(5, 5)
FOR r = 1 TO 4
 FOR cl = 1 TO 4
   IF grid(r, cl) THEN
     FOR diff = -1 TO 1 STEP 2
       ct(r + diff, cl) = ct(r + diff, cl) + 1
       ct(r, cl + diff) = ct(r, cl + diff) + 1
     NEXT
   END IF
 NEXT
NEXT


IF ct(1, 4) = 1 THEN

  REDIM cdct(1, 4)
  FOR r = 1 TO 4
   FOR cl = 1 TO 4
     cdct(grid(r, cl), ct(r, cl)) = cdct(grid(r, cl), ct(r, cl)) + 1
   NEXT
  NEXT


  IF cdct(0, 1) = 4 THEN
  IF cdct(0, 2) = 2 THEN
  IF cdct(0, 3) = 1 THEN
  IF cdct(0, 4) = 1 THEN
  IF cdct(1, 1) = 6 THEN
  IF cdct(1, 2) = 2 THEN
    FOR r = 1 TO 4
      FOR cl = 1 TO 4
        IF grid(r, cl) THEN COLOR 15, 0:  ELSE COLOR 0, 15
        PRINT STR$(ct(r, cl));
      NEXT
      PRINT
    NEXT
    PRINT
    solCt = solCt + 1
  END IF
  END IF
  END IF
  END IF
  END IF
  END IF

END IF


 grid(rh, ch) = 0
NEXT
 grid(rg, cg) = 0
NEXT
 grid(rf, cf) = 0
NEXT
 grid(re, ce) = 0
NEXT
 grid(rd, cd) = 0
END IF
NEXT
 grid(rc, cc) = 0
NEXT
 grid(rb, cb) = 0
NEXT
 grid(ra, ca) = 0
NEXT

PRINT solCt

finds

1 2 1 1
2 1
3 1
1 4 1 1
2 1 2 1

1 1 1 1
2 1
3 1
1
4 1 2
2 1 2 1

where bold face indicates a black card. These are mirrors of one another along a diagonal.


From "So logical", by Bob Walker, Enigma No. 1612, New Scientist, 11 September 2010, page 30.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Solutioncomplete solutionPaul2010-11-30 22:50:57
re: Possible SolutionJyqm2010-11-30 15:24:54
Possible Solutionbroll2010-11-30 12:56:24
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 (13)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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