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

Home > Logic
Poker Precept (Posted on 2013-04-19) Difficulty: 3 of 5
In a game of poker, one of the hands of five cards had the following features:
  1. There was no card above a 10 (an ace is above a 10 in poker).
  2. No two cards were of the same value.
  3. All four suits were represented.
  4. The total values of the odd and even cards were equal.
  5. No three cards were in sequence.
  6. The black cards totaled 10 in value.
  7. The hearts totaled 14.
  8. The lowest card was a spade.
What was the hand?

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution the computer method | Comment 3 of 4 |

DECLARE SUB permute (a$)
CLS
FOR a = 2 TO 6
 v(1) = a
 IF a MOD 2 = 1 THEN oddtot = oddtot + a:  ELSE eventot = eventot + a
FOR b = a + 1 TO 7
 v(2) = b
 IF b MOD 2 = 1 THEN oddtot = oddtot + b:  ELSE eventot = eventot + b
FOR c = b + 1 TO 8
 v(3) = c
 IF c MOD 2 = 1 THEN oddtot = oddtot + c:  ELSE eventot = eventot + c
FOR d = c + 1 TO 9
 v(4) = d
 IF d MOD 2 = 1 THEN oddtot = oddtot + d:  ELSE eventot = eventot + d
FOR e = d + 1 TO 10
 v(5) = e
 IF e MOD 2 = 1 THEN oddtot = oddtot + e:  ELSE eventot = eventot + e

 IF c - a = 2 OR d - b = 2 OR e - c = 2 THEN good = 0:  ELSE good = 1
 IF good THEN
  IF oddtot = eventot THEN
    PRINT : PRINT a; b; c; d; e
    a$ = "shdc": h$ = a$
    GOSUB chkperms
    a$ = "hhdc": h$ = a$
    GOSUB chkperms
    a$ = "hddc": h$ = a$
    GOSUB chkperms
    a$ = "hdcc": h$ = a$
    GOSUB chkperms
  END IF
 END IF

 IF e MOD 2 = 1 THEN oddtot = oddtot - e:  ELSE eventot = eventot - e
NEXT
 IF d MOD 2 = 1 THEN oddtot = oddtot - d:  ELSE eventot = eventot - d
NEXT
 IF c MOD 2 = 1 THEN oddtot = oddtot - c:  ELSE eventot = eventot - c
NEXT
 IF b MOD 2 = 1 THEN oddtot = oddtot - b:  ELSE eventot = eventot - b
NEXT
 IF a MOD 2 = 1 THEN oddtot = oddtot - a:  ELSE eventot = eventot - a
NEXT

END

chkperms:
    DO
      suit$ = "s" + a$
      btot = 0: htot = 0
      FOR i = 1 TO 5
        IF MID$(suit$, i, 1) = "s" OR MID$(suit$, i, 1) = "c" THEN btot = btot + v(i)
        IF MID$(suit$, i, 1) = "h" THEN htot = htot + v(i)
      NEXT
      IF btot = 10 AND htot = 14 THEN
        PRINT suit$
      END IF
      permute a$
    LOOP UNTIL a$ = h$
RETURN

 

finds

 2  4  5  8  9
sdhch

 2  4  7  9  10

indicating the denominations were 2,4,5,8 and 9 and their respective suits were s, d, h, c and h.

The additional set of denominations fit the denomination tests but could not be fit to the suit tests.

BTW, if clue 5 were left out, the solution would still be the same, but the half-solutions (only the denomination tests done) would have been greater in number:

 2  3  4  6  9

 2  4  5  6  7

 2  4  5  8  9
sdhch

 2  4  7  9  10

 2  6  7  8  9

Edited on April 19, 2013, 1:09 pm
  Posted by Charlie on 2013-04-19 13:06:57

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
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