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

Home > Logic
A Skirmish (Posted on 2014-02-05) Difficulty: 3 of 5
Three goblins traveling together chanced to encounter a giant, who was alone, and two ogres, who were walking together. A skirmish broke out among them and all combatants suffered bumps and bruises. . Their weapons included 3 clubs, 2 staves, and 1 sling, used for hurling stones.

  1. The names of the six contenders were: Opi, Rido, Som, Sumo, Tor and Zeb.
  2. No goblin used a staff, nor did Tor.
  3. The two ogres used different weapons.
  4. The sling was used by one of the goblins.
  5. Som, who was not an ogre, used a staff.
  6. Opi did not use a club, nor was he a goblin.
  7. Tor and Zeb used different weapons.
From the above statements, find out which ones were the goblins, which ones were the ogres, which one was the giant, and what weapon did each use?

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: 6 scenarios? | Comment 1 of 3

DECLARE SUB permute (a$)
CLS
DIM typ AS STRING, weap AS STRING

typ = "gggoot": ht$ = typ    'goblin, ogre, giant
DO
weap = "cccssl": hw$ = weap        'club, staff, sling
DO

  good = 1
  o1$ = "": gslingct = 0
  IF MID$(weap, 5, 1) = "s" THEN good = 0
  FOR i = 1 TO 6
    IF MID$(typ, i, 1) = "g" AND MID$(weap, i, 1) = "s" THEN good = 0
    IF MID$(typ, i, 1) = "o" THEN
      IF o1$ = "" THEN
        o1$ = MID$(weap, i, 1)
      ELSE
        IF o1$ = MID$(weap, i, 1) THEN good = 0
      END IF
    END IF
    IF MID$(typ, i, 1) = "g" AND MID$(weap, i, 1) = "l" THEN gslingct = gslingct + 1
  NEXT
  IF gslingct = 0 THEN good = 0
  IF MID$(typ, 3, 1) = "o" THEN good = 0
  IF MID$(weap, 3, 1) <> "s" THEN good = 0
  IF MID$(typ, 1, 1) = "g" THEN good = 0
  IF MID$(weap, 1, 1) = "c" THEN good = 0
  IF MID$(weap, 5, 1) = MID$(weap, 6, 1) THEN good = 0
  IF good THEN PRINT typ: PRINT weap: PRINT

  permute weap
LOOP UNTIL weap = hw$
  permute typ
LOOP UNTIL typ = ht$

 

finds

ogtggo
scsclc
ogtgog
scsccl
ogtogg
scsccl
ogtogg
scsclc
ootggg
scsccl
ootggg
scsclc

where the order for each scenario is the original given name order: Opi, Rido, Som, Sumo, Tor and Zeb. The first line has g, t and o to represent goblin, giant and ogre respectively, and the second line has s, c and l to represent staff, club and sling.


  Posted by Charlie on 2014-02-05 12:33:12
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 (0)
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