On Tue, Jan 05, 2010 at 06:50:51PM -0800, Eliot Miranda wrote:
> > 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. Yes, brute force is acceptable in American football. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Eliot Miranda-2
Yes, I think that would do it. What class is #allPairsDo: defined?
2010/1/5 Eliot Miranda <[hidden email]>
-- -JT _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
On Tue, 5 Jan 2010, John Toohey wrote:
> Yes, I think that would do it. What class is #allPairsDo: defined? It's not defined. Add it to Collection as an extension of your package. Here's Eliot's version: allPairsDo: aBinaryBlock self do: [:first| self do: [:second| aBinaryBlock value: first value: second]] Levente > > 2010/1/5 Eliot Miranda <[hidden email]> > >> >> >> 2010/1/5 John Toohey <[hidden email]> >> >>> 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. >> >> >> So that has to be #(0), (2 to: limit) allPairsDo: right? Since 2 is the >> lowest score, 3 the next, 4 = 2 + 2, 5 = 3 + 2, right? >> >> >>> >>> 2010/1/5 Eliot Miranda <[hidden email]> >>> >>> >>>> >>>> 2010/1/5 John Toohey <[hidden email]> >>>> >>>> :-) >>>>> >>>>> 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 <[hidden email] >>>>>> wrote: >>>>> >>>>>>>>>>> "John" == John Toohey <[hidden email]> 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 >>>>>> <[hidden email]> <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 >>>>>> [hidden email] >>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> -JT >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Pharo-project mailing list >>>>> [hidden email] >>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >>>>> >>>> >>>> >>>> _______________________________________________ >>>> Pharo-project mailing list >>>> [hidden email] >>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >>>> >>> >>> >>> >>> -- >>> -JT >>> >>> >>> >>> _______________________________________________ >>> Pharo-project mailing list >>> [hidden email] >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >>> >> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > > > -- > -JT > Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by John Toohey
>>>>> "John" == John Toohey <[hidden email]> writes:
John> Yep, the four scores would be 1 point conversion, 2 point conversion or a John> safety, 3 point field goal, and a 6 point touchdown. Although the 1 point John> can only come after a 6 point touchdown, so any score with just a 1 point John> would not be possible, but in theory, you could have 2-2, 4-4 etc. So it isn't really 1, 2, 3, 6. It's 2, 3, 6, 7 maybe? Dunno football - just trying to decipher what you said. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[hidden email]> <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 [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by David T. Lewis
>>>>> "David" == David T Lewis <[hidden email]> writes:
David> Yes, brute force is acceptable in American football. And mandatory in Ozzie Rules. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[hidden email]> <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 [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |