R
Ruby Quiz
The three rules of Ruby Quiz:
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
http://www.rubyquiz.com/
3. Enjoy!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There was an interesting thread on Ruby Talk recently about Truth Maintenance
Systems (TMS). One reason to use a TMS is to validate inferences, given certain
truths. We'll focus on that application here.
This week's Ruby Quiz is to build an inference engine that is capable of
answering questions based on the provided truths.
Note that our Perl friends have already done this quiz, with their own Perl Quiz
of the Week. It was an interesting problem that generated good solutions and
discussion. Because of that, I'm going to copy the format used there,
originally by Dan Sanderson and Mark Jason Dominus.
You should be able to teach your engine truths with the following inputs:
All PLURAL-NOUN are PLURAL-NOUN.
No PLURAL-NOUN are PLURAL-NOUN.
Some PLURAL-NOUN are PLURAL-NOUN.
Some PLURAL-NOUN are not PLURAL-NOUN.
You should also be able to query your engine with the following questions:
Are all PLURAL-NOUN PLURAL-NOUN?
Are no PLURAL-NOUN PLURAL-NOUN?
Are any PLURAL-NOUN PLURAL-NOUN?
Are any PLURAL-NOUN not PLURAL-NOUN?
Describe PLURAL-NOUN.
Here's a sample run straight out of the Perl Quiz to show how all of this fits
together:
All dogs are hairy animals.
No dogs are cats.
Some dogs are beagles.
Some dogs are brown animals.
Some dogs are brown things.
In the discussion of the Perl Quiz, some very interesting examples were posted.
Here's my favorite, which we'll call extra credit:
That's not the correct answer. See how your engine answers that question.
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
http://www.rubyquiz.com/
3. Enjoy!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
There was an interesting thread on Ruby Talk recently about Truth Maintenance
Systems (TMS). One reason to use a TMS is to validate inferences, given certain
truths. We'll focus on that application here.
This week's Ruby Quiz is to build an inference engine that is capable of
answering questions based on the provided truths.
Note that our Perl friends have already done this quiz, with their own Perl Quiz
of the Week. It was an interesting problem that generated good solutions and
discussion. Because of that, I'm going to copy the format used there,
originally by Dan Sanderson and Mark Jason Dominus.
You should be able to teach your engine truths with the following inputs:
All PLURAL-NOUN are PLURAL-NOUN.
No PLURAL-NOUN are PLURAL-NOUN.
Some PLURAL-NOUN are PLURAL-NOUN.
Some PLURAL-NOUN are not PLURAL-NOUN.
You should also be able to query your engine with the following questions:
Are all PLURAL-NOUN PLURAL-NOUN?
Are no PLURAL-NOUN PLURAL-NOUN?
Are any PLURAL-NOUN PLURAL-NOUN?
Are any PLURAL-NOUN not PLURAL-NOUN?
Describe PLURAL-NOUN.
Here's a sample run straight out of the Perl Quiz to show how all of this fits
together:
Yes, all beagles are hairy animals.All mammals are hairy animals. OK.
All dogs are mammals. OK.
All beagles are dogs. OK.
Are all beagles hairy animals?
Sorry, that contradicts what I already know.All cats are mammals. OK.
All cats are hairy animals. I know.
Are all cats dogs? I don't know.
No cats are dogs. OK.
Are all cats dogs? No, not all cats are dogs.
Are no cats dogs? Yes, no cats are dogs.
All mammals are dogs.
Yes, some dogs are brown things.Some mammals are brown animals. OK.
Are any mammals dogs? Yes, some mammals are dogs.
Are any dogs brown animals? I don't know.
Some dogs are brown animals. OK.
All brown animals are brown things. OK.
Are any dogs brown things?
All dogs are mammals.Describe dogs.
All dogs are hairy animals.
No dogs are cats.
Some dogs are beagles.
Some dogs are brown animals.
Some dogs are brown things.
I don't know anything about goldfish.Are all goldfish mammals?
In the discussion of the Perl Quiz, some very interesting examples were posted.
Here's my favorite, which we'll call extra credit:
I don't know.All dogs are mammals OK.
No octopuses are mammals OK.
Are any octopuses dogs?
That's not the correct answer. See how your engine answers that question.