• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cave In

 
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Five miners charged out of the shaft of a mine as the timbers caved in behind them.
Jeb was not the first out. Cain was neither first nor last.John Henry pushed out immediately behind Jeb. Preach wasn't second out. Zane was two men behind Preach. In what order did the men race from the mine ?

And another.....



Place the numbers from 1 to 6 in the circles of the triangle so that the numbers in every circle below two higher circles show the difference between the two numbers in the higher circles.
How should the numbers be positioned to show this ?
regards
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I won't show my answer to the first question yet, but I'll add a followup: how much information can you delete from the original question and still end up with the same unique answer?
For the second question, I don't know how many solutions there are, but here are several:

Those were easy enough to find that I suppose the next step is for someone to write a program to find all solutions; I'll let someone else do that.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Jess solution:

And executing it gives:
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
interesting JESS code -- I'd never seen any "In action"
I didn't write code for the 1st question -- but yay I got it right.
I got this variation for the 2nd question:
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An interesting Jess Rules application and the correct answer.
There seem to be only four combinations to the second question, those listed by Jim and Jess. (Ah! That's a name crying out for a pre-schooler book like Janet and John. Note how the order is important- John and Janet and Jess and Jim won't sound right. It's a rhyming thing. I presume John and Jess have more rhyming potential tucked at the end. That's another for Tim Allen )
To restate the second problem to make it easier to write a program.
Construct pyramids of n-numbers in sequence where the numbers in a position below two higher positions shows the difference between two numbers in the higher positions. The n-th number must be in the top row since it is not the difference between any two other numbers.
Try it out with n-th numbers of 3,6,10,15; the first two have 2 and 4 solutions respectively.
Lots of valid sequences for 10 which always fail on the last number- ?

But I finally got this : hurray!


I suspect for 15 you'd have to start the pyramid at 6 to release the smaller numbers into the pool.


regards
[ October 26, 2003: Message edited by: HS Thomas ]
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wrote a dumb little Swing program to let me play with this problem. This program doesn't actually produce an answer, it just let's you try out different solutions.
It produces a tiny inverted triangle of textfields. Only the top row is editable, changes there ripple down. If you reach a good solution, the top row goes green, otherwise it goes red.
I'll see if I can write the one that finds all the solutions (probably shouoldn't be all that hard).
 
Timothy Chen Allen
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a BRUTE FORCE method for finding solutions for the pyramid problem. It's awful. The only performance gain I got was from realizing that I could just set the top three numbers and then calculate the rest of the pyramid.
I suppose this could be extended to allow for larger pyramids, but that would just extend the awfulness of this solution.
Anyway, here's the code:

And here are the solutions:
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
#Absolutely
#I should have added that there should be no reflections .#( #I dropped coffee on my keyboard so it's typing funny. #I cannot get rid of this ghost#)

#But it's cool that a program can get the reflections as well whereas a human can do them automatically.
regards
 
Timothy Chen Allen
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by HS Thomas:

#But it's cool that a program can get the reflections as well whereas a human can do them automatically.
regards


An excellent observation about the comparative abilities of humans and computers. For the computer to see that a pyramid adds up correctly is a simple operation, whereas this operation for a human may require substantial thought and even (in the case of my wife) paper and pencil!
Seeing the symmetry of an object is dead simple for a human, but for a computer it would be hard work. And a human can identify the symmetry of an object even if it is only partially symmetrical. Consider the teapot-- a human would figure out easily that the main body is a symmetrical object, and that it had some non-symmetrical features (the handle and spout). But a computer would have to have a very extensive program to do this, and could be thrown off by seemingly minor inconsistencies.
On the other hand, our wetware probably has just such a complex "program" built in over years and years of observing objects.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

An interesting twist to the above.
Arrange the numbers from 1 to 6 in the triangle so that the sum of each straight line of three circles gives the same result. How would you place the numbers ? Switch and swap explorations will yield four unique solutions excluding rotations and reflections.

(I would try combining the two problems in one program. Using Jess would help breaking the rules so that they could be used in both problems, I think . Pity my book hasn't arrived and no trace of a distributor )
regards
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd think you could switch and swap on three numbers at a time.
For one problem , explore the differences, for the other explore the sum.
Then switch and swap again if it didn't work. If the program remembers rotations and reflections then it wouldn't go down the route again.

regards.
[ November 07, 2003: Message edited by: HS Thomas ]
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the Sums answer by placing the low numbers counter-clock-wise ath the points
[CODE]
1 X 3
X X
2
[CODE]
and then filled in the high numbers counter-clock-wise in the center
[CODE]
1 5 3
6 4
2
[CODE]
I made sure that the 6 (highest high number) was in the same line as the 1-2 (lowest combination of low numbers) and filled in from there.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right , Joel.
There are three more, at least.
regards
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic