Challenge 11  Wave the Flag    PLEASE DO NOT RESPOND UNTIL 5/28/2012  12 am
EST

 

Here's a little preparation for Memorial Day.

 

    S=:10 16$(16$' '),176$(16$'*  '),16$' * '

   T=:10 36$(36$'#'),72$' '

   U=:9 52$(104$' '),364$(52$'#'),104$' '

   <' ',"1(((S,"1 ' '),.T),U),"1 ' '

--------------------------------------------------------┐
│                  #################################### │
│ *  *  *  *  *  *                                      │
│  *  *  *  *  *                                        │
│ *  *  *  *  *  * #################################### │
│  *  *  *  *  *                                        │
│ *  *  *  *  *  *                                      │
│  *  *  *  *  *   #################################### │
│ *  *  *  *  *  *                                      │
│  *  *  *  *  *                                        │
│ *  *  *  *  *  * #################################### │
│                                                       │
│                                                       │
│ ####################################################  │
│                                                       │
│                                                       │
│ ####################################################  │
│                                                       │
│                                                       │
│ ####################################################  │
L--------------------------------------------------------

 

Part 1:  Use viewmat and create a little flag. Next design a function to
rotate it clockwise 90 degrees successively until it is in the original
position.

 

   load viewmat 

   flag=:

wwwwwwww
wwwwwwww
wwwwwwww
wwwwwwww

wwwwwwwwwwwwww

wwwwwwww
wwwwwwww
wwwwwwww
wwwwwwww

wwwwwwwwwwwwww

wwwwwwww
wwwwwwww
wwwwwwww
wwwwwwww

wwwwwwwwwwwwww

wwwwwwww
wwwwwwww
wwwwwwww
wwwwwwww

wwwwwwwwwwwwww

wwwwwwww
wwwwwwww
wwwwwwww
wwwwwwww

   

Part 2:   

 

   A=:'we celebrate Memorial Day on May the twenty eighth'

   wave=:

------------T-----------T-----------T-----------T-----------┐
│----------┐│----------┐│----------┐│----------┐│----------┐│
││   we    │││      Mc │││  hthgie │││ e       │││   we    ││
││celebrate│││et    ee │││  ytnewt │││ tl      │││celebrate││
││Memorial │││iw    ml │││   eht   │││ aa    yh│││Memorial ││
││   Day   │││getMoDoew│││   yaM   │││ riy yett│││   Day   ││
││   on    │││hnhanarbe│││    no   │││ebranahnh│││   on    ││
││   May   │││ttey yir │││   yaD   │││weoDoMteg│││   May   ││
││   the   │││hy    aa │││ lairomeM│││ lm    wi│││   the   ││
││ twenty  │││      lt │││etarbelec│││ ee    te│││ twenty  ││
││ eighth  │││       e │││    ew   │││ cM      │││ eighth  ││
│L----------│L----------│L----------│L----------│L----------│
L-----------+-----------+-----------+-----------+------------

 

Reshape A into a 9 9 square matrix. Justify all lines in the center. If a
line has an even number of letters put the extra letter on the left. Now
design a function to rotate the words in a similar fashion to the flag
above.  Note the letters in "we" as they move around clockwise. Your
function should work for any square literal matrix.

 

Happy Memorial Day!

 

Linda

 

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to