Author Topic: Chelsea Flower Show  (Read 2782 times)

Offline Tarquin Thunderthighs lll

  • .
  • Posts: 5823
  • They call me Tarqs... and other stuff.
Re: Chelsea Flower Show
« Reply #15 on: October 05, 2021, 12:43:30 PM »
It's a piece of cool programming from a piece of software I wrote this year to create random maths questions (with answers).

It's cool mostly because it's one line of programming (though it's split over several lines for readability).

The main program never changes (as it just creates maths questions) but the repositories from which it chooses the questions must be capable of being added to without having to re-compile the main program, so they are placed in separate files called assemblies.

The function examines the assemblies that contain the maths questions and creates (and returns) a list of all available maths questions that the user can choose from.

return assemblies   
   .SelectMany(    turn a list of lists into a single list
      x => x
      .GetTypes()    get all the types in the assemblies
      .Where(t => t.Namespace != null && t.Namespace.Contains(".LCQ") && t.Name.StartsWith("LCQ"))    filter out the ones we need
      .SelectMany(      turn the inner list of lists into a single list
         u => Enumerable   
            .Range(0, (int)u.GetProperty("Count").GetValue(null))    get the number of questions in each type and number them
            .Select(    for each question, select the question title, the question number, and the question type
               v => (   
                        Title: (string)u.GetMethod("Title").Invoke(null, new object[] { v }),
                        QNo: v,
                        QType: u
                     )
            )
         .ToList()
      )
   )
   .ToDictionary(   create a dictionary out of the questions indexed by their title
      t => t.Title,
      t => (t.QType, t.QNo)
   );





Bet you're glad you asked now, Diane.

Anything that produces random maths questions (even with answers) is the spawn of Satan as far as I'm concerned.
I apologise, in advance.

Offline Mince

  • .
  • Posts: 6958
  • Utter Waste of Time
Re: Chelsea Flower Show
« Reply #16 on: October 05, 2021, 05:09:27 PM »
Anything that produces random maths questions (even with answers) is the spawn of Satan as far as I'm concerned.

So, school teachers are the spawn of Satan. Noted.

Offline Diane CBPFC

  • .
  • Posts: 4509
Re: Chelsea Flower Show
« Reply #17 on: October 05, 2021, 06:17:31 PM »
my apologies - I thought you were trying to depict a flower with text - which WOULD have been cool seeing this is a show garden thread.
« Last Edit: October 05, 2021, 06:21:28 PM by Diane CBPFC »
People will come from strange lands to hear me speak my words of wisdom. They will ask me the secret of life and I will tell them. Then maybe I'll finish off with a song. The Nomad

Offline Tarquin Thunderthighs lll

  • .
  • Posts: 5823
  • They call me Tarqs... and other stuff.
Re: Chelsea Flower Show
« Reply #18 on: October 05, 2021, 08:14:44 PM »
So, school teachers are the spawn of Satan. Noted.

Maths teachers…and tutors…but only the male ones….certainly.
I apologise, in advance.

Offline Mince

  • .
  • Posts: 6958
  • Utter Waste of Time
Re: Chelsea Flower Show
« Reply #19 on: October 06, 2021, 01:43:53 PM »

                  _(_)_                          wWWWw   _
      @@@@       (_)@(_)   vVVVv     _     @@@@  (___) _(_)_
     @@()@@ wWWWw  (_)\    (___)   _(_)_  @@()@@   Y  (_)@(_)
      @@@@  (___)     `|/    Y    (_)@(_)  @@@@   \|/   (_)\
       /      Y       \|    \|/    /(_)    \|      |/      |
    \ |     \ |/       | / \ | /  \|/       |/    \|      \|/
    \\|//   \\|///  \\\|//\\\|/// \|///  \\\|//  \\|//  \\\|//
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^




Offline Diane CBPFC

  • .
  • Posts: 4509
Re: Chelsea Flower Show
« Reply #20 on: October 06, 2021, 02:51:25 PM »
Now this is clever!


                  _(_)_                          wWWWw   _
      @@@@       (_)@(_)   vVVVv     _     @@@@  (___) _(_)_
     @@()@@ wWWWw  (_)\    (___)   _(_)_  @@()@@   Y  (_)@(_)
      @@@@  (___)     `|/    Y    (_)@(_)  @@@@   \|/   (_)\
       /      Y       \|    \|/    /(_)    \|      |/      |
    \ |     \ |/       | / \ | /  \|/       |/    \|      \|/
    \\|//   \\|///  \\\|//\\\|/// \|///  \\\|//  \\|//  \\\|//
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^




People will come from strange lands to hear me speak my words of wisdom. They will ask me the secret of life and I will tell them. Then maybe I'll finish off with a song. The Nomad

Offline Mince

  • .
  • Posts: 6958
  • Utter Waste of Time
Re: Chelsea Flower Show
« Reply #21 on: October 06, 2021, 03:09:15 PM »
Then wait till you see this!

                                     .,.               .,;;;;;,           
                                    ;;;;;;;,,        ,;;%%%%%;;           
                                      `;;;%%%%;;,.  ,;;%%;;%%%;;
                                        `;%%;;%%%;;,;;%%%%%%%;;'
                                         `;;%%;;%:,;%%%%%;;%%;;,
                                            `;;%%%,;%%%%%%%%%;;;
                                               `;:%%%%%%;;%%;;;'         
           ..,,,.                                 .:::::::.               
        .;;;;;;;;;;,.                                  s.                 
        `;;;;;;;;;;;;;,                               ,SSSs.             
          `:.:.:.:.:.:.:.                            ,SSSSSSs.           
           .;;;;;;;;;;;;;::,                        ,SSSSSSSSS,           
          ;;;;;;;;;;;;;;;;:::%,                    ,SS%;SSSSSSsS         
         ;;;;;;,:,:::::::;::::%%,                  SS%;SSSSSSsSS         
         ;;;;;,::a@@@@@@a::%%%%%%%,.   ...         SS%;SSSSSSSS'         
         `::::::@@@@@@@@@@@a;%%%%%%%%%'  #;        `SS%;SSSSS'           
  .,sSSSSs;%%,::@@@@@@;;' #`@@a;%%%%%'   ,'          `S%;SS'             
sSSSSSSSSSs;%%%,:@@@@a;;   .@@@a;%%sSSSS'           .%%%;SS,             
`SSSSSSSSSSSs;%%%,:@@@a;;;;@@@;%%sSSSS'        ..,,%%%;SSSSSSs.           
  `SSSSSSSSSSSSs;%%,%%%%%%%%%%%SSSS'     ..,,%;sSSS;%;SSSSSSSSs.         
     `SSSSSSSSSSS%;%;sSSSS;""""   ..,,%sSSSS;;SSSS%%%;SSSSSSSSSS.         
         """""" %%;SSSSSS;;%..,,sSSS;%SSSSS;%;%%%;%%%%;SSSSSS;SSS.       
                `;SSSSS;;%%%%%;SSSS;%%;%;%;sSSS;%%%%%%%;SSSSSS;SSS       
                 ;SSS;;%%%%%%%%;%;%sSSSS%;SSS;%%%%%%%%%;SSSSSS;SSS       
                 `S;;%%%%%%%%%%%%%SSSSS;%%%;%%%%%%%%%%%;SSSSSS;SSS       
                  ;SS;%%%%%%%%%%%%;%;%;%%;%%%%%%%%%%%%;SSSSSS;SSS'       
                  SS;%%%%%%%%%%%%%%%%%%%;%%%%%%%%%%%;SSSSSS;SSS'         
                  SS;%%%%%%%%%%%%%%%%%%;%%%%%%%%%%%;SSSSS;SSS'           
                  SS;%%%%%%%%%%%%%;sSSs;%%%%%%%%;SSSSSS;SSSS             
                  `SS;%%%%%%%%%%%%%%;SS;%%%%%%;SSSSSS;SSSS'               
                   `S;%%%%%%%%%%%%%%%;S;%%%%%;SSSS;SSSSS%                 
                    `S;%;%%%%%%%%%%%'   `%%%%;SSS;SSSSSS%.               
                    ,S;%%%%%%%%%%;'      `%%%%%;S   `SSSSs%,.             
                  ,%%%%%%%%%%;%;'         `%;%%%;     `SSSs;%%,.         
               ,%%%%%%;;;%;;%;'           .%%;%%%       `SSSSs;%%.       
            ,%%%%%' .%;%;%;'             ,%%;%%%'         `SSSS;%%       
          ,%%%%'   .%%%%'              ,%%%%%'             `SSs%%'       
        ,%%%%'    .%%%'              ,%%%%'                ,%%%'         
      ,%%%%'     .%%%              ,%%%%'                 ,%%%'           
    ,%%%%'      .%%%'            ,%%%%'                  ,%%%'           
  ,%%%%'        %%%%           ,%%%'                    ,%%%%             
  %%%%'       .:::::         ,%%%'                      %%%%'             
.:::::        :::::'       ,%%%'                       ,%%%%             
:::::'                   ,%%%%'                        %%%%%             
                        %%%%%'                         %%%%%             
                      .::::::                        .::::::             
                      ::::::'                        ::::::'             

Offline Diane CBPFC

  • .
  • Posts: 4509
Re: Chelsea Flower Show
« Reply #22 on: October 07, 2021, 12:16:56 AM »
Yeah, that's a bit too much there buddy. 
People will come from strange lands to hear me speak my words of wisdom. They will ask me the secret of life and I will tell them. Then maybe I'll finish off with a song. The Nomad