facerows=. 0 0 0 , 0 1 0 ,: 1 0 1 NB. 3 row types on faces facechars=. ' o' NB. chars used to draw faces faces=: 0 1 0,1 0 1,1 1 1,2 0 2,2 1 2,:2 2 2 NB. faces in terms of rows dice=: <"2 facechars {~ facerows {~ faces NB. draw faces of a dice throw=: ] {~ [: ? [ $ [: # ] NB. verb to throw dice toss=: 2 10 throw dice NB. 2 dice thrown 10 times c=: ([: +/ [: , 'o' = ,)&>/ toss NB. totals of each throw fd=: [: /:~ ({. , #)/.~ NB. calc frequency distribution assert 0 0 0 3 = 4!:0 ;:'dice toss c fd' NB. check word types follow rules
2011/11/26 Linda Alvord <lindaalv...@verizon.net>: > PLEASE DO NOT REPLY BEFORE December I, 2011 at 12:00 am EST ! > > The turkey roll challenge, named in honor of the Thanksgiving Day > holiday, focuses on the verb roll or ? with one argument. > > Create two nouns and a verb that will generate the following results. > > dice > > ----T---T---T---T---T---┐ > │ │o │o │o o│o o│o o│ > │ o │ │ o │ │ o │o o│ > │ │ o│ o│o o│o o│o o│ > L---+---+---+---+---+---- > > toss > > ----T-T---T-T---T-T---T-T---T-T---T-T---T-T---T-T---T-T---┐ > │o │ │o o│ │o o│ │o o│ │o │ │o o│ │o │ │o o│ │o │ │o o│ > │ │ │ │ │ o │ │o o│ │ o │ │ │ │ o │ │ o │ │ o │ │o o│ > │ o│ │o o│ │o o│ │o o│ │ o│ │o o│ │ o│ │o o│ │ o│ │o o│ > +---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+ > │ │ │o o│ │o │ │o o│ │o o│ │o o│ │o o│ │o │ │ │ │o o│ > │ o │ │ │ │ │ │o o│ │o o│ │ │ │o o│ │ │ │ o │ │o o│ > │ │ │o o│ │ o│ │o o│ │o o│ │o o│ │o o│ │ o│ │ │ │o o│ > L---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---- > > c=:3 8 7 12 9 8 9 7 4 12 NB. The list c is the sums of the > NB. second toss of ten dice > fd c > > 3 1 NB. A frequency distribution of the ten tosses > 4 1 > 7 2 > 8 2 > 9 2 > 12 2 > > > 4!:0 'dice';'toss';'c';'fd' > 0 0 0 3 NB. 0 for nouns, 3 for verbs > > Some rules and hints: > Write all verbs and nouns without @ . You can use several nouns and > verbs to make a final noun or verb. Here are some things about roll. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm