 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Suit Settlement (Posted on 2014-01-29) Wilson, Xavier, Yoeman and Zenger were playing a card game, in which three cards, from each player's holding, remained to be played; and in which one of the four suits - clubs, diamonds, hearts, and spades (denoted respectively as C, D, H and S)- was the high suit. A high suit is just like a trump suit in many card games.

The play of four cards, one from each player's holding was a trick, and the suit of the card played first in a trick was the suit led.

 The distribution of the four suits on the cards held by the four players was as follows:
```Wilson's  holding -- C   H   D
Xavier's  holding -- C   S   S
Yoeman's  holding -- C   H   H
Zenger's  holding -- S   D   D```
[2a] A player had to play a card in the suit led, if possible, at each trick.
[2b] If [2a] is not possible, he had to play a high suit.
[2c] If [2b] is also not possible, then he could play any card.
 Each of the remaining three tricks contained in part: the suit card led, just one other card in the same suit as led, and a high suit card which won the trick.
 A player who won a trick had to lead at the next trick.

Which suit was the high suit?

 See The Solution Submitted by K Sengupta Rating: 4.0000 (1 votes) Comments: ( Back to comment list | You must be logged in to post comments.) computer solution Comment 2 of 2 | DECLARE SUB playIt (trick!, player!)
DIM SHARED suits AS STRING, hs AS STRING, firstplayer, hsplayer(3)
DIM SHARED phand(4) AS STRING, plr(3) AS STRING, played(3) AS STRING, leadp
suits = "chsd"
CLS
FOR highsuit = 1 TO 4
hs = MID\$(suits, highsuit, 1)
FOR leadp = 1 TO 4
phand(1) = "chd"
phand(2) = "css"
phand(3) = "chh"
phand(4) = "sdd"

firstplayer = leadp
playIt 1, firstplayer
NEXT
NEXT

SUB playIt (trick, player)
DIM handhold AS STRING
'   PRINT trick, player
IF player = firstplayer THEN
FOR i = 1 TO LEN(phand(player))
handhold = phand(player)
phand(player) = LEFT\$(handhold, i - 1) + MID\$(handhold, i + 1)
plr(trick) = MID\$("WXYZ", player, 1)
played(trick) = MID\$(handhold, i, 1)
IF firstplayer = 1 THEN
playIt trick, 2
ELSE
playIt trick, 1
END IF
phand(player) = handhold
NEXT
ELSE
ixled = INSTR(phand(player), LEFT\$(played(trick), 1))
IF ixled THEN
handhold = phand(player)
phand(player) = LEFT\$(handhold, ixled - 1) + MID\$(handhold, ixled + 1)
plr(trick) = plr(trick) + MID\$("WXYZ", player, 1)
played(trick) = played(trick) + MID\$(handhold, ixled, 1)
IF MID\$(handhold, ixled, 1) = hs THEN hsplayer(trick) = player
IF player = 4 OR player = 3 AND firstplayer = 4 THEN
GOSUB checkIt
IF good THEN
IF trick = 3 THEN
GOSUB reportIt
ELSE
IF hsplayer(trick) > 0 THEN
fpsave = firstplayer
firstplayer = hsplayer(trick)
playIt trick + 1, firstplayer
firstplayer = fpsave
END IF
END IF
END IF
ELSE
IF player + 1 = firstplayer THEN
playIt trick, player + 2
ELSE
playIt trick, player + 1
END IF
END IF
plr(trick) = LEFT\$(plr(trick), LEN(plr(trick)) - 1)
played(trick) = LEFT\$(played(trick), LEN(played(trick)) - 1)
phand(player) = handhold
ELSE
ixhigh = INSTR(phand(player), hs)
IF ixhigh THEN
handhold = phand(player)
phand(player) = LEFT\$(handhold, ixhigh - 1) + MID\$(handhold, ixhigh + 1)
plr(trick) = plr(trick) + MID\$("WXYZ", player, 1)
played(trick) = played(trick) + MID\$(handhold, ixhigh, 1)
IF MID\$(handhold, ixhigh, 1) = hs THEN hsplayer(trick) = player
IF player = 4 OR player = 3 AND firstplayer = 4 THEN
GOSUB checkIt
IF good THEN
IF trick = 3 THEN
GOSUB reportIt
ELSE
IF hsplayer(trick) > 0 THEN
fpsave = firstplayer
firstplayer = hsplayer(trick)
playIt trick + 1, firstplayer
firstplayer = fpsave
END IF
END IF
END IF
ELSE
IF player + 1 = firstplayer THEN
playIt trick, player + 2
ELSE
playIt trick, player + 1
END IF
END IF
plr(trick) = LEFT\$(plr(trick), LEN(plr(trick)) - 1)
played(trick) = LEFT\$(played(trick), LEN(played(trick)) - 1)
phand(player) = handhold
ELSE
FOR i = 1 TO LEN(phand(player))
handhold = phand(player)
phand(player) = LEFT\$(handhold, i - 1) + MID\$(handhold, i + 1)
plr(trick) = plr(trick) + MID\$("WXYZ", player, 1)
played(trick) = played(trick) + MID\$(handhold, i, 1)

IF player = 4 OR player = 3 AND firstplayer = 4 THEN
GOSUB checkIt
IF good THEN
IF trick = 3 THEN
GOSUB reportIt
ELSE
IF hsplayer(trick) > 0 THEN
fpsave = firstplayer
firstplayer = hsplayer(trick)
playIt trick + 1, firstplayer
firstplayer = fpsave
END IF
END IF
END IF
ELSE
IF player + 1 = firstplayer THEN
playIt trick, player + 2
ELSE
playIt trick, player + 1
END IF
END IF

phand(player) = handhold
plr(trick) = LEFT\$(plr(trick), LEN(plr(trick)) - 1)
played(trick) = LEFT\$(played(trick), LEN(played(trick)) - 1)
NEXT
END IF

END IF

END IF

EXIT SUB

checkIt:

good = 1
ixchk = INSTR(2, played(trick), MID\$(played(trick), 1, 1))
IF ixchk = 0 THEN good = 0
IF ixchk > 0 THEN
ixchk = INSTR(MID\$(played(trick), ixchk + 1), MID\$(played(trick), 1, 1))
IF ixchk > 0 THEN good = 0
END IF
IF INSTR(MID\$(played(trick), 2), hs) = 0 THEN good = 0

RETURN

reportIt:
PRINT "   "; plr(1); " "; plr(2); " "; plr(3); " "
PRINT leadp; played(1); " "; played(2); " "; played(3); " "; hs
PRINT
RETURN

END SUB

finds these scenarios that work, all with Diamonds as the high suit:

`  WXYZ ZWXY WXYZ1 hchd sdsh cscd d`
`  WXYZ ZWXY WXYZ1 hshd sdsc cchd d`
`  WXYZ ZWXY WXYZ1 hshd sdsc cchd d`
`  YWXZ ZWXY WXYZ3 hhcd sdsh cscd d`
`  YWXZ ZWXY WXYZ3 hhsd sdsc cchd d`
`  YWXZ ZWXY WXYZ3 hhsd sdsc cchd d`
`  YWXZ ZWXY WXYZ3 hhcd sdsh cscd d`
`  YWXZ ZWXY WXYZ3 hhsd sdsc cchd d`
`  YWXZ ZWXY WXYZ3 hhsd sdsc cchd d`

To take the last scenario, what is being said by the above format is:

The 3rd player (Yoeman) leads the first trick, playing a heart, with Wilson, Xavier and Zenger playing heart, spade and diamond respectively in that trick. In the second trick, Zenger leads with a spade and Wilson, Xavier and Yeoman follow with diamond, spade and club respectively. In the third trick, Wilson leads with a club and Xavier, Yeoman and Zenger follow with club, heart and diamond respectively. Again, diamond was the high suit.

 Posted by Charlie on 2014-01-29 18:55:46 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 (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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