Yep, the four scores would be 1 point conversion, 2 point conversion or a safety, 3 point field goal, and a 6 point touchdown. Although the 1 point can only come after a 6 point touchdown, so any score with just a 1 point would not be possible, but in theory, you could have 2-2, 4-4 etc.


2010/1/5 Eliot Miranda <eliot.miranda@gmail.com>


2010/1/5 John Toohey <jt@parspro.com>

:-)

I don't suppose you have an equally elegant solution to the scores for a NFL game, where the units can be 1,2,3,6, assuming that each team could score a total of say, 35 points.��

Since the increments include 1 this is equivalent to (0 to: max) allPairsDo: ... ��i.e. it is possible for a team to continue to score a single point, therefore the possible pairs of scores are all the pairs from 0 to N.

But isn't American Football more complex? ��an't you only score 1 after scoring a touchdown? ��What are the scoring rules? ��In any case your numbers are so small that you can use brute force and enumerate all possible combinations, filtering totals that exceed your limit.



On Tue, Jan 5, 2010 at 21:26, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>> "John" == John Toohey <jt@parspro.com> writes:

John> Thank you, duly chastened. I did know the formulae for P and C, but didn't
John> know how to add the repetitions. My original code was :-
John> |c|
John> c := SortedCollection new.
John> c add: '0, 0'; add:'1, 1'; add: '2, 2'; add:'3, 3'; add: '4, 4'.
John> (0 to: 4) combinations: 2 atATimeDo:[:each | c add: each asCommaString. ��c
John> add:( each reverse) asCommaString].

"Every time I cut with this wide saw, it removes 1/2 inch from the wood!
I'll just glue it back after the cuts!"

"why don't you just use the laser cutter? ��no losses!"

:-)

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



--
-JT



_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



--
-JT