The Weekly Challenge - 286

Monday, Sep 9, 2024| Tags: Perl, Raku

TABLE OF CONTENTS


01. HEADLINES

02. SPONSOR

03. RECAP

04. PERL REVIEW

05. RAKU REVIEW

06. CHART

07. NEW MEMBERS

08. GUESTS

09. TASK #1: Self Spammer

10. TASK #2: Order Game


HEADLINES


Welcome to the Week #286 of The Weekly Challenge.

Let us all welcome guest contributor, Peter Pentchev, to the Team PWC. Thanks for sharing solutions in Python and Rust. I have see many contributions in Python and Rust before but this seems to be truly complete solutions. I always believe you never stop learning. And I learn something new every week from each contributions.

Did you notice I use the term guest contributor for Peter Pentchev?

Those who are new to the Team PWC, it is just my way of differentiating between regular and guest contributors. Anyone who contributes in languages other than Perl and Raku is a guest contributor. We maintain two list of contributors i.e. Regular Contributors and Guest Contributors. To become a regular contributor, one can simply contribute in either Perl or Raku just once. As of today, we have 14 guest contributors and 315 regular contributors. You can get the details in the Team page.

Welcome back to blogging, David Ferrone and thanks for sharing the blog post.

Welcome back, Asher Harvey-Smith and thanks for sharing solutions in APL, BQN, Haskell, Hy, J, K and Raku.

Thank you, Torgny Lyon, for sharing blog post for the first time. Hope to see more in coming weeks.

Peter Meszaros, thank you for continuous support and contributions.

Thank you, Jorg Sommrey, for your dedication. It rarely happens to see an additional blog post, Sorting Without Sort, to talk about another approach to solve past task Relative Sort.


Last 5 weeks mainstream contribution stats. Thank you Team PWC for your support and encouragements.

  Week      Perl       Raku       Blog   
   281       58       25       23   
   282       64       23       18   
   283       62       25       16   
   284       68       23       16   
   285       61       23       18   

Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.

  Week      Guests       Contributions       Languages   
   281       15       64       23   
   282       14       64       21   
   283       12       61       21   
   284       20       74       24   
   285       16       71       25   

TOP 10 Guest Languages


Do you see your favourite language in the Top #10? If not then why not contribute regularly and make it to the top.

 1. Python     (2790)
 2. Rust       (737)
 3. Ruby       (725)
 4. Haskell    (703)
 5. Lua        (638)
 6. C          (579)
 7. C++        (544)
 8. JavaScript (481)
 9. Go         (404)
10. BQN        (363)

Blogs with Creative Title


1. No Connection by Arne Sommer.

2. Lost Connections and Making Changes by David Ferrone.

3. Change With No Way Out by Jorg Sommrey.

4. Connected Coins in an Unconnected World by Matthias Muth.

5. Exact Change Only! by Packy Anderson.

6. Dead end coins by Peter Campbell Smith.

7. Making Connections by Roger Bell_West.

8. Making connections by Simon Green.


GitHub Repository Stats


1. Commits: 40,080 (+135)

2. Pull Requests: 10,783 (+46)

3. Contributors: 253 (+1)

4. Fork: 319 (+1)

5. Stars: 175



With start of Week #268, we have a new sponsor Lance Wicks for the entire year 2024. Having said we are looking for more sponsors so that we can go back to weekly winner. If anyone interested please get in touch with us at perlweeklychallenge@yahoo.com. Thanks for your support in advance.


RECAP


Quick recap of The Weekly Challenge - 285 by Mohammad Sajid Anwar.


PERL REVIEW


If you missed any past reviews then please check out the collection.


RAKU REVIEW


If you missed any past reviews then please check out the collection.


CHART


Please take a look at the charts showing interesting data.

I would like to THANK every member of the team for their valuable suggestions. Please do share your experience with us.


NEW MEMBERS


Peter Pentchev joined Team PWC.

Please find out How to contribute?, if you have any doubts.

Please try the excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.


GUESTS


Please check out the guest contributions for the Week #285.

Please find past solutions by respected guests. Please share your creative solutions in other languages.


Task 1: Self Spammer

Submitted by: David Ferrone

Write a program which outputs one word of its own script / source code at random. A word is anything between whitespace, including symbols.

Example 1

If the source code contains a line such as: 'open my $fh, "<", "ch-1.pl" or die;'
then the program would output each of the words { open, my, $fh,, "<",, "ch-1.pl", or, die; }
(along with other words in the source) with some positive probability.

Example 2

Technically 'print(" hello ");' is *not* an example program, because it does not
assign positive probability to the other two words in the script.
It will never display print(" or ");

Example 3

An empty script is one trivial solution, and here is another:
echo "42" > ch-1.pl && perl -p -e '' ch-1.pl

Task 2: Order Game

Submitted by: Mohammad Sajid Anwar

You are given an array of integers, @ints, whose length is a power of 2.

Write a script to play the order game (min and max) and return the last element.

Example 1

Input: @ints = (2, 1, 4, 5, 6, 3, 0, 2)
Output: 1

Operation 1:

    min(2, 1) = 1
    max(4, 5) = 5
    min(6, 3) = 3
    max(0, 2) = 2

Operation 2:

    min(1, 5) = 1
    max(3, 2) = 3

Operation 3:

    min(1, 3) = 1

Example 2

Input: @ints = (0, 5, 3, 2)
Output: 0

Operation 1:

    min(0, 5) = 0
    max(3, 2) = 3

Operation 2:

    min(0, 3) = 0

Example 3

Input: @ints = (9, 2, 1, 4, 5, 6, 0, 7, 3, 1, 3, 5, 7, 9, 0, 8)
Output: 2

Operation 1:

    min(9, 2) = 2
    max(1, 4) = 4
    min(5, 6) = 5
    max(0, 7) = 7
    min(3, 1) = 1
    max(3, 5) = 5
    min(7, 9) = 7
    max(0, 8) = 8

Operation 2:

    min(2, 4) = 2
    max(5, 7) = 7
    min(1, 5) = 1
    max(7, 8) = 8

Operation 3:

    min(2, 7) = 2
    max(1, 8) = 8

Operation 4:

    min(2, 8) = 2


Last date to submit the solution 23:59 (UK Time) Sunday 15th September 2024.


SO WHAT DO YOU THINK ?

If you have any suggestions or ideas then please do share with us.

Contact with me